From 2a67327941910feadbfd953e4f8b53e675d5fe1a Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sat, 19 Jul 2008 15:40:21 +0000 Subject: Added WAV playlist and conf_set/get_level API to Python module git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2158 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/python/_pjsua.c | 127 +++++++++++++++++++++++ pjsip-apps/src/python/pjsua.py | 228 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 342 insertions(+), 13 deletions(-) (limited to 'pjsip-apps') diff --git a/pjsip-apps/src/python/_pjsua.c b/pjsip-apps/src/python/_pjsua.c index 6590dd5c..65a48e90 100644 --- a/pjsip-apps/src/python/_pjsua.c +++ b/pjsip-apps/src/python/_pjsua.c @@ -3456,6 +3456,76 @@ static PyObject *py_pjsua_conf_disconnect return Py_BuildValue("i", status); } +/* + * py_pjsua_conf_set_tx_level + */ +static PyObject *py_pjsua_conf_set_tx_level +(PyObject *pSelf, PyObject *pArgs) +{ + int slot; + float level; + int status; + + PJ_UNUSED_ARG(pSelf); + + if (!PyArg_ParseTuple(pArgs, "if", &slot, &level)) + { + return NULL; + } + + status = pjsua_conf_adjust_tx_level(slot, level); + + + return Py_BuildValue("i", status); +} + +/* + * py_pjsua_conf_set_rx_level + */ +static PyObject *py_pjsua_conf_set_rx_level +(PyObject *pSelf, PyObject *pArgs) +{ + int slot; + float level; + int status; + + PJ_UNUSED_ARG(pSelf); + + if (!PyArg_ParseTuple(pArgs, "if", &slot, &level)) + { + return NULL; + } + + status = pjsua_conf_adjust_rx_level(slot, level); + + + return Py_BuildValue("i", status); +} + +/* + * py_pjsua_conf_get_signal_level + */ +static PyObject *py_pjsua_conf_get_signal_level +(PyObject *pSelf, PyObject *pArgs) +{ + int slot; + unsigned tx_level, rx_level; + int status; + + PJ_UNUSED_ARG(pSelf); + + if (!PyArg_ParseTuple(pArgs, "i", &slot)) + { + return NULL; + } + + status = pjsua_conf_get_signal_level(slot, &tx_level, &rx_level); + + + return Py_BuildValue("iff", status, (float)(tx_level/255.0), + (float)(rx_level/255.0)); +} + /* * py_pjsua_player_create */ @@ -3481,6 +3551,45 @@ static PyObject *py_pjsua_player_create return Py_BuildValue("ii", status, id); } +/* + * py_pjsua_playlist_create + */ +static PyObject *py_pjsua_playlist_create +(PyObject *pSelf, PyObject *pArgs) +{ + int id; + int options; + PyObject *arg_label, *arg_filelist; + pj_str_t label; + int count; + pj_str_t files[64]; + int status; + + PJ_UNUSED_ARG(pSelf); + + if (!PyArg_ParseTuple(pArgs, "OOi", &arg_label, &arg_filelist, &options)) + { + return NULL; + } + label.ptr = PyString_AsString(arg_label); + label.slen = PyString_Size(arg_label); + + if (!PyList_Check(arg_filelist)) + return NULL; + + count = 0; + for (count=0; count