python3-pjsip icon indicating copy to clipboard operation
python3-pjsip copied to clipboard

Unable to send dtmf using dial_dtmf

Open saisyam opened this issue 5 years ago • 2 comments

I was trying to send dtmf events using dial_dtmf method but always returns PJ_EINVAL. I tried with string and bytes as well. I looked into your code and found the method PyUnicode_ToPJ which is doing the conversion. The method uses PyUnicode_Check(obj). It seems Python3 str object is not passing this method. I tried following: call.dial_dtmf(b'5551234567#') `call.dial_dtmf('5551234567#')

None worked.

saisyam avatar May 31 '20 13:05 saisyam

I have commented PyBytes_Check in the method to make DTMF work: `static PyObject *py_pjsua_call_dial_dtmf(PyObject *pSelf, PyObject *pArgs) { int call_id; PyObject *pDigits; pj_str_t digits; int status;

PJ_UNUSED_ARG(pSelf);

if (!PyArg_ParseTuple(pArgs, "iO", &call_id, &pDigits)) {
    return NULL;
}
/*
if (!PyBytes_Check(pDigits))
return Py_BuildValue("i", PJ_EINVAL);
*/
digits = PyUnicode_ToPJ(pDigits);
status = pjsua_call_dial_dtmf(call_id, &digits);
return Py_BuildValue("i", status);

}`

saisyam avatar Jun 02 '20 02:06 saisyam

After send dtmf calling is suspend, no errors

CraftedCat avatar Sep 02 '22 19:09 CraftedCat