]> sjero.net Git - linphone/blob - LinphoneCoreImpl.java
add g729 integration
[linphone] / LinphoneCoreImpl.java
1 /*
2 LinphoneCoreImpl.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 package org.linphone.core;
20
21 import java.io.File;
22 import java.io.IOException;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.Vector;
26
27
28 class LinphoneCoreImpl implements LinphoneCore {
29
30         @SuppressWarnings("unused")
31         private final  LinphoneCoreListener mListener; //to make sure to keep a reference on this object
32         private long nativePtr = 0;
33         private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object  userdata);
34         private native void iterate(long nativePtr);
35         private native long getDefaultProxyConfig(long nativePtr);
36
37         private native void setDefaultProxyConfig(long nativePtr,long proxyCfgNativePtr);
38         private native int addProxyConfig(LinphoneProxyConfig jprtoxyCfg,long nativePtr,long proxyCfgNativePtr);
39         private native void clearAuthInfos(long nativePtr);
40         
41         private native void clearProxyConfigs(long nativePtr);
42         private native void addAuthInfo(long nativePtr,long authInfoNativePtr);
43         private native Object invite(long nativePtr,String uri);
44         private native void terminateCall(long nativePtr, long call);
45         private native long getRemoteAddress(long nativePtr);
46         private native boolean  isInCall(long nativePtr);
47         private native boolean isInComingInvitePending(long nativePtr);
48         private native void acceptCall(long nativePtr, long call);
49         private native long getCallLog(long nativePtr,int position);
50         private native int getNumberOfCallLogs(long nativePtr);
51         private native void delete(long nativePtr);
52         private native void setNetworkStateReachable(long nativePtr,boolean isReachable);
53         private native void setPlaybackGain(long nativeptr, float gain);
54         private native float getPlaybackGain(long nativeptr);
55         private native void muteMic(long nativePtr,boolean isMuted);
56         private native long interpretUrl(long nativePtr,String destination);
57         private native Object inviteAddress(long nativePtr,long to);
58         private native Object inviteAddressWithParams(long nativePtrLc,long to, long nativePtrParam);
59         private native void sendDtmf(long nativePtr,char dtmf);
60         private native void clearCallLogs(long nativePtr);
61         private native boolean isMicMuted(long nativePtr);
62         private native long findPayloadType(long nativePtr, String mime, int clockRate);
63         private native int enablePayloadType(long nativePtr, long payloadType,  boolean enable);
64         private native void enableEchoCancellation(long nativePtr,boolean enable);
65         private native boolean isEchoCancellationEnabled(long nativePtr);
66         private native Object getCurrentCall(long nativePtr) ;
67         private native void playDtmf(long nativePtr,char dtmf,int duration);
68         private native void stopDtmf(long nativePtr);
69         private native void setVideoWindowId(long nativePtr, Object wid);
70         private native void setPreviewWindowId(long nativePtr, Object wid);
71         private native void setDeviceRotation(long nativePtr, int rotation);
72         private native void addFriend(long nativePtr,long friend);
73         private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status);
74         private native long createChatRoom(long nativePtr,String to);
75         private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled);
76         private native boolean isVideoEnabled(long nativePtr);
77         private native void setFirewallPolicy(long nativePtr, int enum_value);
78         private native int getFirewallPolicy(long nativePtr);
79         private native void setStunServer(long nativePtr, String stun_server);
80         private native String getStunServer(long nativePtr);
81         private native long createDefaultCallParams(long nativePtr);
82         private native int updateCall(long ptrLc, long ptrCall, long ptrParams);
83         private native void setUploadBandwidth(long nativePtr, int bw);
84         private native void setDownloadBandwidth(long nativePtr, int bw);
85         private native void setPreferredVideoSize(long nativePtr, int width, int heigth);
86         private native int[] getPreferredVideoSize(long nativePtr);
87         private native void setRing(long nativePtr, String path);
88         private native String getRing(long nativePtr);
89         private native void setRootCA(long nativePtr, String path);
90         private native long[] listVideoPayloadTypes(long nativePtr);
91         private native long[] getProxyConfigList(long nativePtr);
92         private native long[] listAudioPayloadTypes(long nativePtr);
93         private native void enableKeepAlive(long nativePtr,boolean enable);
94         private native boolean isKeepAliveEnabled(long nativePtr);
95         private native int startEchoCalibration(long nativePtr,Object data);
96         private native int getSignalingTransportPort(long nativePtr, int code);
97         private native void setSignalingTransportPorts(long nativePtr, int udp, int tcp, int tls);
98         private native void enableIpv6(long nativePtr,boolean enable);
99         private native void adjustSoftwareVolume(long nativePtr,int db);
100         private native int pauseCall(long nativePtr, long callPtr);
101         private native int pauseAllCalls(long nativePtr);
102         private native int resumeCall(long nativePtr, long callPtr);
103         private native void setUploadPtime(long nativePtr, int ptime);
104         private native void setDownloadPtime(long nativePtr, int ptime);
105         private native void setZrtpSecretsCache(long nativePtr, String file);
106         private native void enableEchoLimiter(long nativePtr2, boolean val);
107         private native int setVideoDevice(long nativePtr2, int id);
108         private native int getVideoDevice(long nativePtr2);
109         private native int getMediaEncryption(long nativePtr);
110         private native void setMediaEncryption(long nativePtr, int menc);
111         private native boolean isMediaEncryptionMandatory(long nativePtr);
112         private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno);
113         
114         
115         LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object  userdata) throws IOException {
116                 mListener=listener;
117                 nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata);
118         }
119         LinphoneCoreImpl(LinphoneCoreListener listener) throws IOException {
120                 mListener=listener;
121                 nativePtr = newLinphoneCore(listener,null,null,null);
122         }
123         
124         protected void finalize() throws Throwable {
125                 
126         }
127         
128         public synchronized void addAuthInfo(LinphoneAuthInfo info) {
129                 isValid();
130                 addAuthInfo(nativePtr,((LinphoneAuthInfoImpl)info).nativePtr);
131         }
132
133
134
135         public synchronized LinphoneProxyConfig getDefaultProxyConfig() {
136                 isValid();
137                 long lNativePtr = getDefaultProxyConfig(nativePtr);
138                 if (lNativePtr!=0) {
139                         return new LinphoneProxyConfigImpl(lNativePtr); 
140                 } else {
141                         return null;
142                 }
143         }
144
145         public synchronized LinphoneCall invite(String uri) {
146                 isValid();
147                 return (LinphoneCall)invite(nativePtr,uri);
148         }
149
150         public synchronized void iterate() {
151                 isValid();
152                 iterate(nativePtr);
153         }
154
155         public synchronized void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) {
156                 isValid();
157                 setDefaultProxyConfig(nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr);
158         }
159         public synchronized void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException{
160                 isValid();
161                 if (addProxyConfig(proxyCfg,nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) {
162                         throw new LinphoneCoreException("bad proxy config");
163                 }
164         }
165         public synchronized void clearAuthInfos() {
166                 isValid();
167                 clearAuthInfos(nativePtr);
168                 
169         }
170         public synchronized void clearProxyConfigs() {
171                 isValid();
172                 clearProxyConfigs(nativePtr);
173         }
174         public synchronized void terminateCall(LinphoneCall aCall) {
175                 isValid();
176                 if (aCall!=null)terminateCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr);
177         }
178         public synchronized LinphoneAddress getRemoteAddress() {
179                 isValid();
180                 long ptr = getRemoteAddress(nativePtr);
181                 if (ptr==0) {
182                         return null;
183                 } else {
184                         return new LinphoneAddressImpl(ptr);
185                 }
186         }
187         public synchronized  boolean isIncall() {
188                 isValid();
189                 return isInCall(nativePtr);
190         }
191         public synchronized boolean isInComingInvitePending() {
192                 isValid();
193                 return isInComingInvitePending(nativePtr);
194         }
195         public synchronized void acceptCall(LinphoneCall aCall) {
196                 isValid();
197                 acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr);
198                 
199         }
200         public synchronized Vector<LinphoneCallLog> getCallLogs() {
201                 isValid();
202                 Vector<LinphoneCallLog> logs = new Vector<LinphoneCallLog>(); 
203                 for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) {
204                         logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i)));
205                 }
206                 return logs;
207         }
208         public synchronized void destroy() {
209                 isValid();
210                 delete(nativePtr);
211                 nativePtr = 0;
212         }
213         
214         private void isValid() {
215                 if (nativePtr == 0) {
216                         throw new RuntimeException("object already destroyed");
217                 }
218         }
219         public synchronized void setNetworkReachable(boolean isReachable) {
220                 setNetworkStateReachable(nativePtr,isReachable);
221         }
222         public synchronized void setPlaybackGain(float gain) {
223                 setPlaybackGain(nativePtr,gain);
224                 
225         }
226         public synchronized float getPlaybackGain() {
227                 return getPlaybackGain(nativePtr);
228         }
229         public synchronized void muteMic(boolean isMuted) {
230                 muteMic(nativePtr,isMuted);
231         }
232         public synchronized LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException {
233                 long lAddress = interpretUrl(nativePtr,destination);
234                 if (lAddress != 0) {
235                         return new LinphoneAddressImpl(lAddress,true);
236                 } else {
237                         throw new LinphoneCoreException("Cannot interpret ["+destination+"]");
238                 }
239         }
240         public synchronized LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { 
241                 LinphoneCall call = (LinphoneCall)inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr);
242                 if (call!=null) {
243                         return call;
244                 } else {
245                         throw new LinphoneCoreException("Unable to invite address " + to.asString());
246                 }
247         }
248
249         public synchronized void sendDtmf(char number) {
250                 sendDtmf(nativePtr,number);
251         }
252         public synchronized void clearCallLogs() {
253                 clearCallLogs(nativePtr);
254         }
255         public synchronized boolean isMicMuted() {
256                 return isMicMuted(nativePtr);
257         }
258         public synchronized PayloadType findPayloadType(String mime, int clockRate) {
259                 isValid();
260                 long playLoadType = findPayloadType(nativePtr, mime, clockRate);
261                 if (playLoadType == 0) {
262                         return null;
263                 } else {
264                         return new PayloadTypeImpl(playLoadType);
265                 }
266         }
267         public synchronized void enablePayloadType(PayloadType pt, boolean enable)
268                         throws LinphoneCoreException {
269                 isValid();
270                 if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) {
271                         throw new LinphoneCoreException("cannot enable payload type ["+pt+"]");
272                 }
273                 
274         }
275         public synchronized void enableEchoCancellation(boolean enable) {
276                 isValid();
277                 enableEchoCancellation(nativePtr, enable);
278         }
279         public synchronized boolean isEchoCancellationEnabled() {
280                 isValid();
281                 return isEchoCancellationEnabled(nativePtr);
282                 
283         }
284
285         public synchronized LinphoneCall getCurrentCall() {
286                 isValid();
287                 return (LinphoneCall)getCurrentCall(nativePtr);
288         }
289         
290         public int getPlayLevel() {
291                 // TODO Auto-generated method stub
292                 return 0;
293         }
294         public void setPlayLevel(int level) {
295                 // TODO Auto-generated method stub
296                 
297         }
298         public void enableSpeaker(boolean value) {
299                 // TODO Auto-generated method stub
300                 
301         }
302         public boolean isSpeakerEnabled() {
303                 // TODO Auto-generated method stub
304                 return false;
305         }
306         public synchronized void playDtmf(char number, int duration) {
307                 playDtmf(nativePtr,number, duration);
308                 
309         }
310         public synchronized void stopDtmf() {
311                 stopDtmf(nativePtr);
312         }
313         
314         public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException {
315                 addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr);
316                 
317         }
318         public synchronized void setPresenceInfo(int minute_away, String alternative_contact,
319                         OnlineStatus status) {
320                 setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue);
321                 
322         }
323         public synchronized LinphoneChatRoom createChatRoom(String to) {
324                 return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to));
325         }
326         public synchronized void setPreviewWindow(Object w) {
327                 setPreviewWindowId(nativePtr,w);
328         }
329         public synchronized void setVideoWindow(Object w) {
330                 setVideoWindowId(nativePtr, w);
331         }
332         public synchronized void setDeviceRotation(int rotation) {
333                 setDeviceRotation(nativePtr, rotation);
334         }
335         
336         public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) {
337                 enableVideo(nativePtr,vcap_enabled, display_enabled);
338         }
339         public synchronized boolean isVideoEnabled() {
340                 return isVideoEnabled(nativePtr);
341         }
342         public synchronized FirewallPolicy getFirewallPolicy() {
343                 return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr));
344         }
345         public synchronized String getStunServer() {
346                 return getStunServer(nativePtr);
347         }
348         public synchronized void setFirewallPolicy(FirewallPolicy pol) {
349                 setFirewallPolicy(nativePtr,pol.value());
350         }
351         public synchronized void setStunServer(String stunServer) {
352                 setStunServer(nativePtr,stunServer);
353         }
354         
355         public synchronized LinphoneCallParams createDefaultCallParameters() {
356                 return new LinphoneCallParamsImpl(createDefaultCallParams(nativePtr));
357         }
358         
359         public synchronized LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException {
360                 long ptrDestination = ((LinphoneAddressImpl)to).nativePtr;
361                 long ptrParams =((LinphoneCallParamsImpl)params).nativePtr;
362                 
363                 LinphoneCall call = (LinphoneCall)inviteAddressWithParams(nativePtr, ptrDestination, ptrParams);
364                 if (call!=null) {
365                         return call;
366                 } else {
367                         throw new LinphoneCoreException("Unable to invite with params " + to.asString());
368                 }
369         }
370
371         public synchronized int updateCall(LinphoneCall call, LinphoneCallParams params) {
372                 long ptrCall = ((LinphoneCallImpl) call).nativePtr;
373                 long ptrParams = params!=null ? ((LinphoneCallParamsImpl)params).nativePtr : 0;
374
375                 return updateCall(nativePtr, ptrCall, ptrParams);
376         }
377         public synchronized void setUploadBandwidth(int bw) {
378                 setUploadBandwidth(nativePtr, bw);
379         }
380
381         public synchronized void setDownloadBandwidth(int bw) {
382                 setDownloadBandwidth(nativePtr, bw);
383         }
384
385         public synchronized void setPreferredVideoSize(VideoSize vSize) {
386                 setPreferredVideoSize(nativePtr, vSize.width, vSize.height);
387         }
388
389         public synchronized VideoSize getPreferredVideoSize() {
390                 int[] nativeSize = getPreferredVideoSize(nativePtr);
391
392                 VideoSize vSize = new VideoSize();
393                 vSize.width = nativeSize[0];
394                 vSize.height = nativeSize[1];
395                 return vSize;
396         }
397         public synchronized void setRing(String path) {
398                 setRing(nativePtr, path);
399         }
400         public synchronized String getRing() {
401                 return getRing(nativePtr);
402         }
403         
404         public synchronized void setRootCA(String path) {
405                 setRootCA(nativePtr, path);
406         }
407         
408         public synchronized LinphoneProxyConfig[] getProxyConfigList() {
409                 long[] typesPtr = getProxyConfigList(nativePtr);
410                 if (typesPtr == null) return null;
411                 
412                 LinphoneProxyConfig[] proxies = new LinphoneProxyConfig[typesPtr.length];
413
414                 for (int i=0; i < proxies.length; i++) {
415                         proxies[i] = new LinphoneProxyConfigImpl(typesPtr[i]);
416                 }
417
418                 return proxies;
419         }
420         
421         public synchronized PayloadType[] getVideoCodecs() {
422                 long[] typesPtr = listVideoPayloadTypes(nativePtr);
423                 if (typesPtr == null) return null;
424                 
425                 PayloadType[] codecs = new PayloadType[typesPtr.length];
426
427                 for (int i=0; i < codecs.length; i++) {
428                         codecs[i] = new PayloadTypeImpl(typesPtr[i]);
429                 }
430
431                 return codecs;
432         }
433         public synchronized PayloadType[] getAudioCodecs() {
434                 long[] typesPtr = listAudioPayloadTypes(nativePtr);
435                 if (typesPtr == null) return null;
436                 
437                 PayloadType[] codecs = new PayloadType[typesPtr.length];
438
439                 for (int i=0; i < codecs.length; i++) {
440                         codecs[i] = new PayloadTypeImpl(typesPtr[i]);
441                 }
442
443                 return codecs;
444         }
445         public synchronized boolean isNetworkReachable() {
446                 throw new RuntimeException("Not implemented");
447         }
448         public synchronized void enableKeepAlive(boolean enable) {
449                 enableKeepAlive(nativePtr,enable);
450                 
451         }
452         public synchronized boolean isKeepAliveEnabled() {
453                 return isKeepAliveEnabled(nativePtr);
454         }
455         public synchronized void startEchoCalibration(Object data) throws LinphoneCoreException {
456                 startEchoCalibration(nativePtr, data);
457         }
458         
459         public synchronized Transports getSignalingTransportPorts() {
460                 Transports transports = new Transports();
461                 transports.udp = getSignalingTransportPort(nativePtr, 0);
462                 transports.tcp = getSignalingTransportPort(nativePtr, 1);
463                 transports.tls = getSignalingTransportPort(nativePtr, 3);
464                 // See C struct LCSipTransports in linphonecore.h
465                 // Code is the index in the structure
466                 return transports;
467         }
468         public synchronized void setSignalingTransportPorts(Transports transports) {
469                 setSignalingTransportPorts(nativePtr, transports.udp, transports.tcp, transports.tls);
470         }
471
472         public synchronized void enableIpv6(boolean enable) {
473                 enableIpv6(nativePtr,enable);
474         }
475         public synchronized void adjustSoftwareVolume(int i) {
476                 adjustSoftwareVolume(nativePtr, i);
477         }
478
479         public synchronized boolean pauseCall(LinphoneCall call) {
480                 return 0 == pauseCall(nativePtr, ((LinphoneCallImpl) call).nativePtr);
481         }
482         public synchronized boolean resumeCall(LinphoneCall call) {
483                 return 0 == resumeCall(nativePtr, ((LinphoneCallImpl) call).nativePtr);
484         }
485         public synchronized boolean pauseAllCalls() {
486                 return 0 == pauseAllCalls(nativePtr);
487         }
488         public synchronized void setDownloadPtime(int ptime) {
489                 setDownloadPtime(nativePtr,ptime);
490                 
491         }
492         public synchronized void setUploadPtime(int ptime) {
493                 setUploadPtime(nativePtr,ptime);
494         }
495
496         public synchronized void setZrtpSecretsCache(String file) {
497                 setZrtpSecretsCache(nativePtr,file);
498         }
499         public synchronized void enableEchoLimiter(boolean val) {
500                 enableEchoLimiter(nativePtr,val);
501         }
502         public void setVideoDevice(int id) {
503                 Log.i("Setting camera id :", id);
504                 if (setVideoDevice(nativePtr, id) != 0) {
505                         Log.e("Failed to set video device to id:", id);
506                 }
507         }
508         public int getVideoDevice() {
509                 return getVideoDevice(nativePtr);
510         }
511
512
513         private native void leaveConference(long nativePtr);    
514         public synchronized void leaveConference() {
515                 leaveConference(nativePtr);
516         }
517
518         private native boolean enterConference(long nativePtr); 
519         public synchronized boolean enterConference() {
520                 return enterConference(nativePtr);
521         }
522
523         private native boolean isInConference(long nativePtr);
524         public synchronized boolean isInConference() {
525                 return isInConference(nativePtr);
526         }
527
528         private native void terminateConference(long nativePtr);
529         public synchronized void terminateConference() {
530                 terminateConference(nativePtr);
531         }
532         private native int getConferenceSize(long nativePtr);
533         public synchronized int getConferenceSize() {
534                 return getConferenceSize(nativePtr);
535         }
536         private native int getCallsNb(long nativePtr);
537         public synchronized int getCallsNb() {
538                 return getCallsNb(nativePtr);
539         }
540         private native void terminateAllCalls(long nativePtr);
541         public synchronized void terminateAllCalls() {
542                 terminateAllCalls(nativePtr);
543         }
544         private native Object getCall(long nativePtr, int position);
545         @SuppressWarnings("unchecked") public synchronized List getCalls() {
546                 int size = getCallsNb(nativePtr);
547                 List<LinphoneCall> calls = new ArrayList<LinphoneCall>(size);
548                 for (int i=0; i < size; i++) {
549                         calls.add((LinphoneCall)getCall(nativePtr, i));
550                 }
551                 return calls;
552         }
553         private native void addAllToConference(long nativePtr);
554         public synchronized void addAllToConference() {
555                 addAllToConference(nativePtr);
556                 
557         }
558         private native void addToConference(long nativePtr, long nativePtrLcall);
559         public synchronized void addToConference(LinphoneCall call) {
560                 addToConference(nativePtr, getCallPtr(call));
561                 
562         }
563         private native void removeFromConference(long nativePtr, long nativeCallPtr);
564         public synchronized void removeFromConference(LinphoneCall call) {
565                 removeFromConference(nativePtr,getCallPtr(call));
566         }
567
568         private long getCallPtr(LinphoneCall call) {
569                 return ((LinphoneCallImpl)call).nativePtr;
570         }
571
572         private native int transferCall(long nativePtr, long callPtr, String referTo);
573         public synchronized void transferCall(LinphoneCall call, String referTo) {
574                 transferCall(nativePtr, getCallPtr(call), referTo);
575         }
576
577         private native int transferCallToAnother(long nativePtr, long callPtr, long destPtr);
578         public synchronized void transferCallToAnother(LinphoneCall call, LinphoneCall dest) {
579                 transferCallToAnother(nativePtr, getCallPtr(call), getCallPtr(dest));
580         }
581
582         private native Object findCallFromUri(long nativePtr, String uri);
583         @Override
584         public synchronized LinphoneCall findCallFromUri(String uri) {
585                 return (LinphoneCall) findCallFromUri(nativePtr, uri);
586         }
587
588         public MediaEncryption getMediaEncryption() {
589                 return MediaEncryption.fromInt(getMediaEncryption(nativePtr));
590         }
591         public boolean isMediaEncryptionMandatory() {
592                 return isMediaEncryptionMandatory(nativePtr);
593         }
594         public void setMediaEncryption(MediaEncryption menc) {
595                 setMediaEncryption(nativePtr, menc.mValue);     
596         }
597         public void setMediaEncryptionMandatory(boolean yesno) {
598                 setMediaEncryptionMandatory(nativePtr, yesno);
599         }
600
601         private native int getMaxCalls(long nativePtr);
602         public int getMaxCalls() {
603                 return getMaxCalls(nativePtr);
604         }
605         @Override
606         public boolean isMyself(String uri) {
607                 LinphoneProxyConfig lpc = getDefaultProxyConfig();
608                 if (lpc == null) return false;
609                 return uri.equals(lpc.getIdentity());
610         }
611
612         private native boolean soundResourcesLocked(long nativePtr);
613         public boolean soundResourcesLocked() {
614                 return soundResourcesLocked(nativePtr);
615         }
616
617         private native void setMaxCalls(long nativePtr, int max);
618         @Override
619         public void setMaxCalls(int max) {
620                 setMaxCalls(nativePtr, max);
621         }
622         private native boolean isEchoLimiterEnabled(long nativePtr);
623         @Override
624         public boolean isEchoLimiterEnabled() {
625                 return isEchoLimiterEnabled(nativePtr);
626         }
627         private native boolean mediaEncryptionSupported(long nativePtr, int menc);
628         @Override
629         public boolean mediaEncryptionSupported(MediaEncryption menc) {
630                 return mediaEncryptionSupported(nativePtr,menc.mValue);
631         }
632
633         private native void setPlayFile(long nativePtr, String path);
634
635         @Override
636         public void setPlayFile(String path) {
637                 setPlayFile(nativePtr, path);
638         }
639
640
641         private native void tunnelAddServerAndMirror(long nativePtr, String host, int port, int mirror, int ms);
642         @Override
643         public void tunnelAddServerAndMirror(String host, int port, int mirror, int ms) {
644                 tunnelAddServerAndMirror(nativePtr, host, port, mirror, ms);
645         }
646
647         private native void tunnelAutoDetect(long nativePtr);
648         @Override
649         public void tunnelAutoDetect() {
650                 tunnelAutoDetect(nativePtr);
651         }
652
653         private native void tunnelCleanServers(long nativePtr);
654         @Override
655         public void tunnelCleanServers() {
656                 tunnelCleanServers(nativePtr);
657         }
658
659         private native void tunnelEnable(long nativePtr, boolean enable);
660         @Override
661         public void tunnelEnable(boolean enable) {
662                 tunnelEnable(nativePtr, enable);
663         }
664
665         private native void tunnelEnableLogs(long nativePtr, boolean enable);
666         @Override
667         public void tunnelEnableLogs(boolean enable) {
668                 tunnelEnableLogs(nativePtr, enable);
669         }
670
671         @Override
672         public native boolean isTunnelAvailable();
673 }