CSipSimple拨打电话机制分析

CSipSimple是运行在android设备上的一个开源的sip协议应用程序,本文其中的拨打电话机制进行大致分析。

项目中,拨打电话利用了AIDL方法来实现。aidl是 Android Interface definition language的缩写,它是一种android内部进程通信接口的描述语言,通过它来定义进程间的通信接口,完成IPC(Inter-Process Communication,进程间通信)。

创建.aidl文件

ISipService.aidl内容如下:

 

[java]  view plain copy print ?
 
  1. /** 
  2.  * Copyright (C) 2010-2012 Regis Montoya (aka r3gis - www.r3gis.fr) 
  3.  * This file is part of CSipSimple. 
  4.  * 
  5.  *  CSipSimple is free software: you can redistribute it and/or modify 
  6.  *  it under the terms of the GNU General Public License as published by 
  7.  *  the Free Software Foundation, either version 3 of the License, or 
  8.  *  (at your option) any later version. 
  9.  *  If you own a pjsip commercial license you can also redistribute it 
  10.  *  and/or modify it under the terms of the GNU Lesser General Public License 
  11.  *  as an android library. 
  12.  * 
  13.  *  CSipSimple is distributed in the hope that it will be useful, 
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  16.  *  GNU General Public License for more details. 
  17.  * 
  18.  *  You should have received a copy of the GNU General Public License 
  19.  *  along with CSipSimple.  If not, see <http://www.gnu.org/licenses/>. 
  20.  *   
  21.  *  This file and this file only is also released under Apache license as an API file 
  22.  */  
  23. package com.csipsimple.api;  
  24. import com.csipsimple.api.SipProfileState;  
  25. import com.csipsimple.api.SipCallSession;  
  26. import com.csipsimple.api.MediaState;  
  27.   
  28. interface ISipService{  
  29.     /** 
  30.     * Get the current API version 
  31.     * @return version number. 1000 x major version + minor version 
  32.     * Each major version must be compatible with all versions of the same major version 
  33.     */  
  34.   
  35. .........  
  36. void makeCallWithOptions(in String callee, int accountId, in Bundle options);  
  37. }  

ISipService.aidl中定义了包含makeCallWithOptions
方法的接口ISipService。

 

 

自动编译生成java文件

eclipse中的ADT插件会自动在aidl文件中声明的包名目录下生成java文件,如下图所示:


ISipService.java

 

[java]  view plain copy print ?
 
  1. package com.csipsimple.api;  
  2. public interface ISipService extends android.os.IInterface  
  3. {  
  4. ……  
  5. //Place a call  
  6.   
  7. ublic void makeCallWithOptions(java.lang.String callee, int accountId, android.os.Bundle options) throws android.os.RemoteException;  
  8. }  

接下来就是实现ISipService.aidl中定义的接口,提供接口的实例供客户端调用

 

 

IPC实现

项目中拨打电话  

 

void com.csipsimple.api.ISipService.makeCallWithOptions(String msg, String toNumber, long accountId)

结合代码一层层看调用

目录:src\com\csipsimple\ui\dialpad

DialerFragment.java

 

[java]  view plain copy print ?
 
  1. private ISipService service;  
  2. private ServiceConnection connection = new ServiceConnection() {  
  3.   
  4.     @Override  
  5.     public void onServiceConnected(ComponentName arg0, IBinder arg1) {  
  6.         service = ISipService.Stub.asInterface(arg1);  
  7.      ........  
  8.     }  
  9.   
  10.     @Override  
  11.     public void onServiceDisconnected(ComponentName arg0) {  
  12.         service = null;  
  13.     }  
  14. };  

 

 

[java]  view plain copy print ?
 
  1. <span style="color:#333333;">   @Override  
  2.     public void placeCall() {  
  3.         placeCallWithOption(null);  
  4.     }  
  5.   
  6. private void placeCallWithOption(Bundle b) {  
  7.         if (service == null) {  
  8.             return;  
  9.         }  
  10.         String toCall = "";  
  11.         Long accountToUse = SipProfile.INVALID_ID;  
  12.         // Find account to use  
  13.         SipProfile acc = accountChooserButton.getSelectedAccount();  
  14.         if (acc != null) {  
  15.             accountToUse = acc.id;  
  16.         }  
  17.         // Find number to dial  
  18.         if(isDigit) {  
  19.             toCall = PhoneNumberUtils.stripSeparators(digits.getText().toString());  
  20.         }else {  
  21.             toCall = digits.getText().toString();  
  22.         }  
  23.           
  24.         if (TextUtils.isEmpty(toCall)) {  
  25.             return;  
  26.         }  
  27.   
  28.         // Well we have now the fields, clear theses fields  
  29.         digits.getText().clear();  
  30.   
  31.         // -- MAKE THE CALL --//  
  32.         if (accountToUse >= 0) {  
  33.             // It is a SIP account, try to call service for that  
  34.             try {  
  35.                </span><span style="color:#ff0000;"> service.makeCallWithOptions(toCall, accountToUse.intValue(), b);</span><span style="color:#333333;">  
  36.             } catch (RemoteException e) {  
  37.                 Log.e(THIS_FILE, "Service can't be called to make the call");  
  38.             }  
  39.         } else if (accountToUse != SipProfile.INVALID_ID) {  
  40.             // It's an external account, find correct external account  
  41.             CallHandlerPlugin ch = new CallHandlerPlugin(getActivity());  
  42.             ch.loadFrom(accountToUse, toCall, new OnLoadListener() {  
  43.                 @Override  
  44.                 public void onLoad(CallHandlerPlugin ch) {  
  45.                     placePluginCall(ch);  
  46.                 }  
  47.             });  
  48.         }  
  49.     }  
  50.     </span>  

 

这里的调用需要先了解Service的机制
service.makeCallWithOptions(toCall, accountToUse.intValue(), b)
方法调用了ISipService的方法,找到它的代码如下:
目录:src\com\csipsimple\service
[java]  view plain copy print ?
 
  1. 2.服务端  
  2. SipService.java  
  3. /** 
  4.   * 继承 Service发布服务 
  5.   */  
  6.  public class SipService extends Service {  
  7.      ...  
  8.    
  9.      // 为服务实现公共接口, Stub类继承了Binder  
  10.      private final ISipService.Stub binder = new ISipService.Stub() {  
  11.         ...  
  12.        @Override  
  13.         public void makeCallWithOptions(final String callee, final int accountId, final Bundle options)  
  14.                 throws RemoteException {  
  15.             SipService.this.enforceCallingOrSelfPermission(SipManager.PERMISSION_USE_SIP, null);  
  16.             //We have to ensure service is properly started and not just binded  
  17.             SipService.this.startService(new Intent(SipService.this, SipService.class));  
  18.               
  19.             if(pjService == null) {  
  20.                 Log.e(THIS_FILE, "Can't place call if service not started");  
  21.                 // TODO - we should return a failing status here  
  22.                 return;  
  23.             }  
  24.               
  25.             if(!supportMultipleCalls) {  
  26.                 // Check if there is no ongoing calls if so drop this request by alerting user  
  27.                 SipCallSession activeCall = pjService.getActiveCallInProgress();  
  28.                 if(activeCall != null) {  
  29.                     if(!CustomDistribution.forceNoMultipleCalls()) {  
  30.                         notifyUserOfMessage(R.string.not_configured_multiple_calls);  
  31.                     }  
  32.                     return;  
  33.                 }  
  34.             }  
  35.             getExecutor().execute(new SipRunnable() {  
  36.                 @Override  
  37.                 protected void doRun() throws SameThreadException {  
  38.                   <span style="color:#ff0000;">  pjService.makeCall(callee, accountId, options);  
  39.                 }</span>  
  40.             });  
  41.         }  
  42.           


/**
      * 返回一个实现了接口的类对象,给客户端接收
      */
     @Override
     public IBinder onBind(Intent intent) {
 
        String serviceName = intent.getAction();
        Log.d(THIS_FILE, "Action is " + serviceName );
        if (serviceName == null || serviceName.equalsIgnoreCase(SipManager.INTENT_SIP_SERVICE )) {
            Log.d(THIS_FILE, "Service returned");
            return binder ;
        } else if (serviceName. equalsIgnoreCase(SipManager.INTENT_SIP_CONFIGURATION )) {
            Log.d(THIS_FILE, "Conf returned");
            return binderConfiguration ;
        }
        Log.d(THIS_FILE, "Default service (SipService) returned");
        return binder;
     }
     
     ...
 }

 

上文说过,需要实现ISipService.aidl中定义的接口,来提供接口的实例供客户端调用。要实现自己的接口,就从ISipService.Stub类继承,然后实现相关的方法。
Stub类继承了Binder,因此它的对象就可以被远程的进程调用了。如果Service中有对象继承了Stub类,那么这个对象中的方法就可以在Activity等地方中使用,也就是说此时makeCallWithOptions
就可以被其他Activity访问调用了。
现在我们通过onBind(Intent intent)方法得到了可供客户端接收的IBinder对象,就可以回头看看刚才DialerFragment.java文件中的调用情况了。
在客户端(此处也就是调用远程服务的Activity)实现ServiceConnection,在ServiceConnection.onServiceConnected()方法中会接收到IBinder对象,调用ISipService.Stub.asInterface((IBinder)service)将返回值转换为ISipService类型。
语句
[java]  view plain copy print ?
 
  1. <span style="color:#ff0000;">service.makeCallWithOptions(toCall, accountToUse.intValue(), b);</span><span style="font-family: Verdana, Arial, Helvetica, sans-serif;">调用接口中的方法,完成IPC方法。</span>  
回到刚才的服务端实现,在继承Service发布服务的代码中,调用了 pjService.makeCall(callee, accountId, options)方法。
先看看这部分代码:
目录:src\com\csipsimple\pjsip
PjSipService.java
[java]  view plain copy print ?
 
  1. <span style="color:#333333;">public int makeCall(String callee, int accountId, Bundle b) throws SameThreadException {  
  2.         if (!created) {  
  3.             return -1;  
  4.         }  
  5.   
  6.         final ToCall toCall = sanitizeSipUri(callee, accountId);  
  7.         if (toCall != null) {  
  8.             pj_str_t uri = pjsua.pj_str_copy(toCall.getCallee());  
  9.   
  10.             // Nothing to do with this values  
  11.             byte[] userData = new byte[1];  
  12.             int[] callId = new int[1];  
  13.             pjsua_call_setting cs = new pjsua_call_setting();  
  14.             pjsua_msg_data msgData = new pjsua_msg_data();  
  15.             int pjsuaAccId = toCall.getPjsipAccountId();  
  16.               
  17.             // Call settings to add video  
  18.             pjsua.call_setting_default(cs);  
  19.             cs.setAud_cnt(1);  
  20.             cs.setVid_cnt(0);  
  21.             if(b != null && b.getBoolean(SipCallSession.OPT_CALL_VIDEO, false)) {  
  22.                 cs.setVid_cnt(1);  
  23.             }  
  24.             cs.setFlag(0);  
  25.               
  26.             pj_pool_t pool = pjsua.pool_create("call_tmp", 512, 512);  
  27.               
  28.             // Msg data to add headers  
  29.             pjsua.msg_data_init(msgData);  
  30.             pjsua.csipsimple_init_acc_msg_data(pool, pjsuaAccId, msgData);  
  31.             if(b != null) {  
  32.                 Bundle extraHeaders = b.getBundle(SipCallSession.OPT_CALL_EXTRA_HEADERS);  
  33.                 if(extraHeaders != null) {  
  34.                     for(String key : extraHeaders.keySet()) {  
  35.                         try {  
  36.                             String value = extraHeaders.getString(key);  
  37.                             if(!TextUtils.isEmpty(value)) {  
  38.                                 int res = pjsua.csipsimple_msg_data_add_string_hdr(pool, msgData, pjsua.pj_str_copy(key), pjsua.pj_str_copy(value));  
  39.                                 if(res == pjsuaConstants.PJ_SUCCESS) {  
  40.                                     Log.e(THIS_FILE, "Failed to add Xtra hdr (" + key + " : " + value + ") probably not X- header");  
  41.                                 }  
  42.                             }  
  43.                         }catch(Exception e) {  
  44.                             Log.e(THIS_FILE, "Invalid header value for key : " + key);  
  45.                         }  
  46.                     }  
  47.                 }  
  48.             }  
  49.               
  50.             </span><span style="color:#ff0000;">int status = pjsua.call_make_call(pjsuaAccId, uri, cs, userData, msgData, callId);</span><span style="color:#333333;">  
  51.             if(status == pjsuaConstants.PJ_SUCCESS) {  
  52.                 dtmfToAutoSend.put(callId[0], toCall.getDtmf());  
  53.                 Log.d(THIS_FILE, "DTMF - Store for " + callId[0] + " - "+toCall.getDtmf());  
  54.             }  
  55.             pjsua.pj_pool_release(pool);  
  56.             return status;  
  57.         } else {  
  58.             service.notifyUserOfMessage(service.getString(R.string.invalid_sip_uri) + " : "  
  59.                     + callee);  
  60.         }  
  61.         return -1;  
  62.     }</span>  

由红色部分的语句,我们找到pjsua类。
目录:src\org\pjsip\pjsua
pjsua.java
[java]  view plain copy print ?
 
  1. package org.pjsip.pjsua;  
  2.   
  3. public class pjsua implements pjsuaConstants {  
  4. public synchronized static int call_make_call(int acc_id, pj_str_t dst_uri, pjsua_call_setting opt, byte[] user_data, pjsua_msg_data msg_data, int[] p_call_id) {  
  5.    <span style="color:#ff0000;"> return pjsuaJNI.call_make_call</span>(acc_id, pj_str_t.getCPtr(dst_uri), dst_uri, pjsua_call_setting.getCPtr(opt), opt, user_data, pjsua_msg_data.getCPtr(msg_data), msg_data, p_call_id);  
  6.   }  
  7. ..........  
  8. }  
继续看调用,找到pjsuaJNI文件。
目录:src\org\pjsip\pjsua
pjsuaJNI.java
/* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
  * Version 2.0.4
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
  * ----------------------------------------------------------------------------- */
 
 package org.pjsip.pjsua;
 
 public class pjsuaJNI {
 
     ...
     
   public final static native int call_make_call(int jarg1, long jarg2, pj_str_t jarg2_, long jarg3, pjsua_call_setting jarg3_, byte[] jarg4, long jarg5, pjsua_msg_data jarg5_, int[] jarg6);
     
     ...
     
 }

我们看到了native方法call_make_call,它调用的是封装在库libpjsipjni.so中的函数pjsua_call_make_call,进一步可以在jni目录下找到C代码。

目录:jni\pjsip\sources\pjsip\src\pjsua-lib
 
pjsua_call.c
[java]  view plain copy print ?
 
  1. PJ_DEF(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,  
  2.                      const pj_str_t *dest_uri,  
  3.                      const pjsua_call_setting *opt,  
  4.                      void *user_data,  
  5.                      const pjsua_msg_data *msg_data,  
  6.                      pjsua_call_id *p_call_id)  
  7. {  
  8.     pj_pool_t *tmp_pool = NULL;  
  9.     pjsip_dialog *dlg = NULL;  
  10.     pjsua_acc *acc;  
  11.     pjsua_call *call;  
  12.     int call_id = -1;  
  13.     pj_str_t contact;  
  14.     pj_status_t status;  
  15.   
  16.   
  17.     /* Check that account is valid */  
  18.     PJ_ASSERT_RETURN(acc_id>=0 || acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc),   
  19.              PJ_EINVAL);  
  20.   
  21.     /* Check arguments */  
  22.     PJ_ASSERT_RETURN(dest_uri, PJ_EINVAL);  
  23.   
  24.     PJ_LOG(4,(THIS_FILE, "Making call with acc #%d to %.*s", acc_id,  
  25.           (int)dest_uri->slen, dest_uri->ptr));  
  26.   
  27.     pj_log_push_indent();  
  28.   
  29.     PJSUA_LOCK();  
  30.   
  31.     /* Create sound port if none is instantiated, to check if sound device 
  32.      * can be used. But only do this with the conference bridge, as with  
  33.      * audio switchboard (i.e. APS-Direct), we can only open the sound  
  34.      * device once the correct format has been known 
  35.      */  
  36.     if (!pjsua_var.is_mswitch && pjsua_var.snd_port==NULL &&   
  37.     pjsua_var.null_snd==NULL && !pjsua_var.no_snd)   
  38.     {  
  39.     status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev);  
  40.     if (status != PJ_SUCCESS)  
  41.         goto on_error;  
  42.     }  
  43.   
  44.     acc = &pjsua_var.acc[acc_id];  
  45.     if (!acc->valid) {  
  46.     pjsua_perror(THIS_FILE, "Unable to make call because account "  
  47.              "is not valid", PJ_EINVALIDOP);  
  48.     status = PJ_EINVALIDOP;  
  49.     goto on_error;  
  50.     }  
  51.   
  52.     /* Find free call slot. */  
  53.     call_id = alloc_call_id();  
  54.   
  55.     if (call_id == PJSUA_INVALID_ID) {  
  56.     pjsua_perror(THIS_FILE, "Error making call", PJ_ETOOMANY);  
  57.     status = PJ_ETOOMANY;  
  58.     goto on_error;  
  59.     }  
  60.   
  61.     call = &pjsua_var.calls[call_id];  
  62.   
  63.     /* Associate session with account */  
  64.     call->acc_id = acc_id;  
  65.     call->call_hold_type = acc->cfg.call_hold_type;  
  66.   
  67.     /* Apply call setting */  
  68.     status = apply_call_setting(call, opt, NULL);  
  69.     if (status != PJ_SUCCESS) {  
  70.     pjsua_perror(THIS_FILE, "Failed to apply call setting", status);  
  71.     goto on_error;  
  72.     }  
  73.   
  74.     /* Create temporary pool */  
  75.     tmp_pool = pjsua_pool_create("tmpcall10", 512, 256);  
  76.   
  77.     /* Verify that destination URI is valid before calling  
  78.      * pjsua_acc_create_uac_contact, or otherwise there   
  79.      * a misleading "Invalid Contact URI" error will be printed 
  80.      * when pjsua_acc_create_uac_contact() fails. 
  81.      */  
  82.     if (1) {  
  83.     pjsip_uri *uri;  
  84.     pj_str_t dup;  
  85.   
  86.     pj_strdup_with_null(tmp_pool, &dup, dest_uri);  
  87.     uri = pjsip_parse_uri(tmp_pool, dup.ptr, dup.slen, 0);  
  88.   
  89.     if (uri == NULL) {  
  90.         pjsua_perror(THIS_FILE, "Unable to make call",   
  91.              PJSIP_EINVALIDREQURI);  
  92.         status = PJSIP_EINVALIDREQURI;  
  93.         goto on_error;  
  94.     }  
  95.     }  
  96.   
  97.     /* Mark call start time. */  
  98.     pj_gettimeofday(&call->start_time);  
  99.   
  100.     /* Reset first response time */  
  101.     call->res_time.sec = 0;  
  102.   
  103.     /* Create suitable Contact header unless a Contact header has been 
  104.      * set in the account. 
  105.      */  
  106.     if (acc->contact.slen) {  
  107.     contact = acc->contact;  
  108.     } else {  
  109.     status = pjsua_acc_create_uac_contact(tmp_pool, &contact,  
  110.                           acc_id, dest_uri);  
  111.     if (status != PJ_SUCCESS) {  
  112.         pjsua_perror(THIS_FILE, "Unable to generate Contact header",   
  113.              status);  
  114.         goto on_error;  
  115.     }  
  116.     }  
  117.   
  118.     /* Create outgoing dialog: */  
  119.     status = pjsip_dlg_create_uac( pjsip_ua_instance(),   
  120.                    &acc->cfg.id, &contact,  
  121.                    dest_uri, dest_uri, &dlg);  
  122.     if (status != PJ_SUCCESS) {  
  123.     pjsua_perror(THIS_FILE, "Dialog creation failed", status);  
  124.     goto on_error;  
  125.     }  
  126.   
  127.     /* Increment the dialog's lock otherwise when invite session creation 
  128.      * fails the dialog will be destroyed prematurely. 
  129.      <span style="white-space:pre"> </span>*/  
  130.     pjsip_dlg_inc_lock(dlg);  
  131.   
  132.     if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0)  
  133.         pjsip_dlg_set_via_sent_by(dlg, &acc->via_addr, acc->via_tp);  
  134.   
  135.     /* Calculate call's secure level */  
  136.     call->secure_level = get_secure_level(acc_id, dest_uri);  
  137.   
  138.     /* Attach user data */  
  139.     call->user_data = user_data;  
  140.       
  141.     /* Store variables required for the callback after the async 
  142.      * media transport creation is completed. 
  143.      */  
  144.     if (msg_data) {  
  145.     call->async_call.call_var.out_call.msg_data = pjsua_msg_data_clone(  
  146.                                                           dlg->pool, msg_data);  
  147.     }  
  148.     call->async_call.dlg = dlg;  
  149.   
  150.     /* Temporarily increment dialog session. Without this, dialog will be 
  151.      * prematurely destroyed if dec_lock() is called on the dialog before 
  152.      * the invite session is created. 
  153.      */  
  154.     pjsip_dlg_inc_session(dlg, &pjsua_var.mod);  
  155.   
  156.     /* Init media channel */  
  157.     status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC,   
  158.                       call->secure_level, dlg->pool,  
  159.                       NULL, NULL, PJ_TRUE,  
  160.                                       &on_make_call_med_tp_complete);  
  161.     if (status == PJ_SUCCESS) {  
  162.         status = on_make_call_med_tp_complete(call->index, NULL);  
  163.         if (status != PJ_SUCCESS)  
  164.         goto on_error;  
  165.     } else if (status != PJ_EPENDING) {  
  166.     pjsua_perror(THIS_FILE, "Error initializing media channel", status);  
  167.         pjsip_dlg_dec_session(dlg, &pjsua_var.mod);  
  168.     goto on_error;  
  169.     }  
  170.   
  171.     /* Done. */  
  172.   
  173.     if (p_call_id)  
  174.     *p_call_id = call_id;  
  175.   
  176.     pjsip_dlg_dec_lock(dlg);  
  177.     pj_pool_release(tmp_pool);  
  178.     PJSUA_UNLOCK();  
  179.   
  180.     pj_log_pop_indent();  
  181.   
  182.     return PJ_SUCCESS;  
  183.   
  184.   
  185. on_error:  
  186.     if (dlg) {  
  187.     /* This may destroy the dialog */  
  188.     pjsip_dlg_dec_lock(dlg);  
  189.     }  
  190.   
  191.     if (call_id != -1) {  
  192.     reset_call(call_id);  
  193.     pjsua_media_channel_deinit(call_id);  
  194.     }  
  195.   
  196.     if (tmp_pool)  
  197.     pj_pool_release(tmp_pool);  
  198.     PJSUA_UNLOCK();  
  199.   
  200.     pj_log_pop_indent();  
  201.     return status;  
  202. }  
[java]  view plain copy print ?
 
  1. 通过本文的研究分析,<span style="font-family: Consolas; color: rgb(51, 51, 51);">我们了解到CSipSimple通过aidl方法实现进程间通信,从而实现了拨打电话功能。</span> 
〖进阶篇1〗YAML参数解析:从nav2_params.yaml看机器人导航调优 本文深入解析了ROS2 Nav2导航系统中关键的nav2_params.yaml文件,提供了从定位、行为树、运动控制到环境感知等核心模块的参数调优实战指南。文章通过具体场景案例,如狭窄走廊、动态仓库和高精度对接,详细阐述了如何调整AMCL粒子数、控制器权重、代价地图膨胀半径等参数,以解决机器人导航中的犹豫、碰撞和精度问题,帮助开发者实现从“能用”到“好用”的进阶。 阅读详情

相关推荐

Star CCM+ 202206 (17.04) 详细安装步骤

StarCCM+ 17.04 安装包和详细安装步骤

薛定谔的alpha狗 3万+

CSipSimple--简介

该项目将允许Android设备在本地使用SIP。 它依赖于 sip协议栈项目。 支持的功能:     SIP通话和即时讯息     Android的集成与重写和过滤规则     编解码器:PCMU/(又名G711U/年);speex的G722; GSM; ISAC;silk;G729; AMR(取决于器件)作为额外的插件:OPUS;G726,G722.1音频编码

jindegegesun的专栏 2342

算法 A 求稳健平均值和稳健标准差

文章目录算法原理代码 算法原理 算法 A 来自 GB/T 6379.5。应用此算法计算得到数据平均值和标准差的稳健值。稳健性是估计算法的特点,而不是其产生的估计值的特点,因此严格来说,称由此算法计算的平均值和标准差是稳健的是不确切的。然而,为避免使用繁琐的术语,“稳健均值”和“稳健标准差”应理解为利用稳健算法计算的总体均值和总体标准差的均值估计。 设数据为 xi,i∈(1,2,⋯ ,n)x_i, i\in(1,2,\cdots,n)xi​,i∈(1,2,⋯,n),记稳健平均值为 x∗,s∗x^*, s^*x

zhuo木鸟的博客 9259

探秘开源通信神器:CSipSimple

探秘开源通信神器:CSipSimple CSipSimpleCSipSimple 是个款通用的支持SIP协议的互联网电话软件,可以在支持andriod的平板,手机上使用。支持语音编码: G.711 aLaw/uLaw, G.722.1, G.722, SPEEX, SPEEX-WB, AMR-WB, GSM, iLBC, G.729. 支持STUN, Outbound proxy server,...

gitblog_00068的博客 772

量子密钥分发系统的工程实践(四):FPGA在后处理中的核心实现与优化

本文深入探讨了FPGA在量子密钥分发(QKD)系统后处理中的核心实现与优化策略。文章详细拆解了FPGA如何高效完成原始密钥提取、误码协商和私密放大等关键任务,并分享了流水线设计、资源复用及存储器架构优化等工程实践“心法”,旨在解决高速、实时QKD系统中的性能瓶颈,提升密钥生成率。

t8u9v0的博客 388

JS实例(三)图片的缓慢放大和缩小

  我们经常能看到在一些网站中可以通过按钮实现对图片的放大或者缩小,也有可能是鼠标经过时图片放大。在本例中就是通过JavaScript实现图片的放大和缩小。   首先是进行简单的页面布局 1 <div class="imagedispose"> 2 <img src="1.jpeg" id="imaged" width="400px" height="3...

weixin_34235105的博客 314

CSipSimple:安卓上的开源SIP客户端探索

CSipSimple:安卓上的开源SIP客户端探索 CSipSimple CSipSimple Mirror (no pull-requests here) 项目地址: https://gitcode.com/gh_mirrors...

gitblog_00011的博客 851

YOLO26改进策略【YOLO和Mamba】| MLLA:Mamba-Like Linear Attention,融合Mamba设计优势的注意力机制

本文记录的是利用模块优化的目标检测网络模型。模块具有独特优势。它不同于传统模块,能同时兼顾局部特征高效建模与长距离交互学习。常见模块要么在局部特征处理上有优势但长距离交互能力弱,要么反之,而模块克服了此问题。它融合了Mamba模型和线性注意力机制的优势,通过独特的结构设计,能够在保持计算效率的同时,精准地建模局部特征并学习长距离交互信息。本文将其用于的模型改进和二次创新,能够更加关注图像中的重要特征区域,抑制背景等无关信息的干扰,从而突出目标物体的关键特征。Demystify Mamba in Vision

Limiiiing的博客 215

CSipSimple程序之拨打电话

与前面的短信发送一样,这里我们不在重复讲解ViewPage和Fragment以及进程间通信的内容,具体可参考前面的短信发送部分的内容。          在这一部分,主要说明程序是如何从上层到调用本地的JNI库,实现SIP打电话功能的。这里我们主要以用户输入被打用户的SPI URI,即如图点击右下角的txt按钮,然后输入被打用户的URI(如wxm@10.7.106.74),然后点击键盘按钮去往即

自由麦田 3756

【毕设级教程】从0到1实现基于YOLOv8的xView卫星图像目标检测系统(含UI界面,助力遥感智能毕设)

本文基于YOLOv8模型设计了一个面向xView卫星图像的目标检测系统。首先对xView数据集进行了格式转换处理,将原始多边形标注转换为YOLO格式的边界框标注。随后通过配置YOLOv8模型参数完成训练,实现了对卫星图像中建筑、车辆等多类目标的准确识别。为提高系统交互性,采用PyQt开发了可视化界面,支持图像选择、实时检测和结果展示功能。整个系统兼顾学术价值和实用价值,为遥感领域的自动化目标检测提供了可行方案。

m0_64661770的博客 131

R语言LASSO回归作图为什么X轴使用-log(λ)而不是log(λ),如何转化为log(λ)?

🏆本文收录于 《全栈Bug调优(实战版)》 专栏,该专栏专注于分享我在真实项目开发中遇到的各类疑难Bug及其深层成因,并系统提供高效、可复现的解决思路和实操方案。无论你是刚入行的新手开发者,还是拥有多年项目经验的资深工程师,本专栏都将为你提供一条系统化、高质量的问题排查与优化路径,助力你加速成长,攻克技术壁垒,迈向技术价值最大化与职业发展的更高峰🚀!

**My Coding Family** 1019

android 打电话模块,Android 语音通话模块介绍(三) CSipSimple介绍

语音通话模块介绍(三) CSipSimple介绍CSipSimple简介CSipSimple是基于PJSIP开源协议库实现的Android程序,这里主要围绕CSipSimple的功能实现讲解。凡是在CSipSimple中涉及到的Android知识点以及PJSIP相关内都会进一步的分析。项目中主要有几个包:api包下主要是一些静态的常量,关于sip的管理。db包当然是数据库了,它也使用了标准的Con...

weixin_39875675的博客 1275

PyTorch视觉项目实战:从数据加载到模型部署

PyTorch视觉项目实战:从数据加载到模型部署 ,人工智能,计算机视觉,大模型,AI,随着深度学习在计算机视觉领域的飞速发展,PyTorch 凭借其简洁的代码风格、动态计算图特性以及强大的社区支持,成为众多开发者和研究人员的首选框架。从数据加载、模型构建与训练,到最终的模型部署,PyTorch 提供了一套完整且灵活的解决方案。本文将通过实际项目案例,详细阐述基于 PyTorch 的视觉项目全流程,结合丰富的代码示例和概念解析,帮助读者掌握从项目起步到落地的关键技术。

不踩坑,不知道坑有多深;不总结,踩过的坑白踩。 4万+

Android VOIP拨打电话机制分析

【转载自】http://blog.youkuaiyun.com/jindegegesun/article/details/8673514 CSipSimple拨打电话机制分析 CSipSimple是运行在android设备上的一个开源的sip协议应用程序,本文其中的拨打电话机制进行大致分析。 项目中,拨打电话利用了AIDL方法来实现。aidl是 Android Interface

三少GG 3793

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

【亲测免费】 CSipSimple:开源Android SIP客户端,轻松实现VoIP通信

CSipSimple:开源Android SIP客户端,轻松实现VoIP通信 项目介绍 CSipSimple是一款强大且成熟的开源SIP(Session Initiation Protocol)客户端,专为Android平台设计。自2009年由Regis Montoya启动以来,它已经成为许多开发者和终端用户的首选工具,用于在Android设备上构建VoIP(Voice over Internet...

gitblog_01030的博客 1350

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

CSipSimple 简单分析

简介 CSipSimple是一款可以在android手机上使用的支持sip的网络电话软件,可以在上面设置使用callda网络电话。连接使用方式最好是使用wifi,或者3g这样上网速度快,打起电话来效果才好。下面简单分析一下其。 功能介绍 1、注册流程 用户首先选择使用哪国哪个类型,这是由com.csipsimple.wizards.impl包下完成的。该包下实现接口WizardIfac...

xiaoheliushuiya 453

CSipSimple 项目安装与使用教程

CSipSimple 项目安装与使用教程 1. 项目目录结构及介绍 CSipSimple 项目的目录结构如下: CSipSimple/ ├── ActionBarSherlock/ ├── CSipSimple/ │ ├── Branded/ │ │ └── vendors/ │ │ └── callRomania/ │ ├── CodecG729/ │ ├──...

gitblog_00894的博客 471

Android 语音通话模块介绍(三) CSipSimple介绍

语音通话模块介绍(三) CSipSimple介绍   CSipSimple简介       CSipSimple是基于PJSIP开源协议库实现的Android程序,这里主要围绕CSipSimple的功能实现讲解。凡是在CSipSimple中涉及到的Android知识点以及PJSIP相关内都会进一步的分析。 项目中主要有几个包: api包下主要是一些静态的常量,关于sip的管理。 db

YiRong 7342

sip电话软件 android,CSipSimple 是一款可以在Android手机上使用的支持sip的网络电话软件 - 下载 - 搜珍网...

CSipSimple-master/CSipSimple-master/.gitignoreCSipSimple-master/CSipSimple.imlCSipSimple-master/README.mdCSipSimple-master/app/CSipSimple-master/app/app.imlCSipSimple-master/app/build.gradleCSipSimple...

weixin_32218919的博客 3925

csipsimple源码下载以及软件的使用

CSipSimple是一款可以在android手机上使用的支持sip的节费电话软件,可以在上面设置使用callda节费电话。连接使用方式最好是使用wifi,或者3g这样上网速度快,打起电话来效果才好。下面 详细说明其设置使用。 准备工作,打开网站www.callda.com,注册好callda账号,密码使用。 1,下载好csipsimple软件安装在手机上。下载地址:http:

崎山小鹿的专栏 1396

CSipSimple最新版本

要使用CSipSimple有两种方法:第一种是不编译jni,第二种是编译jni.这里介绍的是第一种:不编译jni.首先,用SVN客户端检出CSipSimple源码:svn checkou:http://csipsimple.googlecode.com/svn/trunk/ 检出完成之后有:6个文件夹然后把ActionBarSherlock和CSipSimple两个项目导入...

weixin_33924312的博客 272

CSipSimple程序之基本功能(一)

1 主界面 首先从主界面开始,主界面是SipHome 这个Activity。在该Activity中,引入了Andriod新版本才有的actionBar。ActionBar的作用可以统一页面导航和切换方式,可以突出显示一些重要的操作,而把一些不那么重要的或者使用频率低的放在overflow中。所以这里引入了4个Tab,分别对应DialerFragment ,CallLogListFragment,

自由麦田 2744

CSipSimple 项目常见问题解决方案

CSipSimple 项目常见问题解决方案 1. 项目基础介绍和主要编程语言 CSipSimple 是一个开源项目,它是一个通用的支持SIP协议的互联网电话软件,可以在支持Android系统的平板和手机上使用。该项目提供了丰富的语音编码支持,包括G.711 aLaw/uLaw、G.722、SPEEX、SPEEX-WB、AMR-WB、GSM、iLBC、G.729等。同时,它还支持STUN、Outbo...

gitblog_00062的博客 987

CSipsimple最新版本编译

CSipsimple是依赖pjsip协议,官网http://code.google.com/p/csipsimple/,官网上也有已经编译好的apk,对于编译CSipsimple有两种方式,一种就是要编译jni,另一种编译jni,直接使用已经编译好的这两种我都会说一下,首先说比较简单的一种,这个在官网上 也有介绍http://code.google.com/p/csipsimple/wiki/Ho

jwzhangjie的专栏 2万+

Android Call(打电话)的基本知识详解

weixin_34248705的博客 261
上一篇: SIP related
下一篇: port exosip to android
whatsyourname
博客等级 码龄23年 13粉丝 326原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值