我正在尝试在voip通话中发送dtmf。
为了做到这一点,我正在使用
mCall.dialDtmf(String.valueOf(dtmf));
mCall是呼叫表格PjSip。
调用此函数时,我捕获到异常:
04-25 16:03:57.867 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: java.lang.Exception: Title: pjsua_call_dial_dtmf(id, &pj_digits)
04-25 16:03:57.867 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: Code: 70013
04-25 16:03:57.867 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: Description: Invalid operation (PJ_EINVALIDOP)
04-25 16:03:57.867 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: Location: ../src/pjsua2/call.cpp:551
04-25 16:03:57.879 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at org.pjsip.pjsua2.pjsua2JNI.Call_dialDtmf(Native Method)
04-25 16:03:57.879 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at org.pjsip.pjsua2.Call.dialDtmf(Call.java:143)
04-25 16:03:57.879 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at com.kaymera.kphoneapp.voipEngine.PJCall.dialDtmf(PJCall.java:115)
04-25 16:03:57.879 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at com.kaymera.kphoneapp.voipEngine.calls.VoipCall.sendDTMF(VoipCall.java:149)
04-25 16:03:57.879 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at kphoneapp.kymera.kvoip.myapplication.MainActivity.generateDtmf(MainActivity.java:223)
04-25 16:03:57.880 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at kphoneapp.kymera.kvoip.myapplication.MainActivity$$ViewBinder$11.doClick(MainActivity$$ViewBinder.java:110)
04-25 16:03:57.880 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
04-25 16:03:57.880 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at android.view.View.performClick(View.java:4764)
04-25 16:03:57.880 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at android.view.View$PerformClick.run(View.java:19844)
04-25 16:03:57.880 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
04-25 16:03:57.880 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
04-25 16:03:57.881 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at android.os.Looper.loop(Looper.java:135)
04-25 16:03:57.881 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5349)
04-25 16:03:57.881 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at java.lang.reflect.Method.invoke(Native Method)
04-25 16:03:57.881 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
04-25 16:03:57.881 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
04-25 16:03:57.881 19670-19670/kphoneapp.kymera.kvoip.myapplication W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
我该如何解决?
最佳答案
我有类似的问题,问题是服务器对DTMF使用了不同的方法。
当我的服务器使用DTMF的SIP INFO调用时,DialDtmf方法使用RFC 2833。
这是适用于我的服务器的代码:
CallSendRequestParam prm = new CallSendRequestParam();
prm.setMethod("INFO");
SipTxOption txo = new SipTxOption();
txo.setContentType(" application/dtmf-relay");
txo.setMsgBody("Signal=" + String.valueOf(code) + "\n" + "Duration=160");
prm.setTxOption(txo);
call.sendRequest(prm);
关于android - 如何在Android上使用pjsip发送dtmf?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36859535/