From 3e7fd859b0c02776768f4ef1649a06929918fbe3 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 4 Oct 2007 06:17:58 +0000 Subject: Ticket #389: Added new commands in pjsua to change codec priorities and send UPDATE git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1471 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsua/pjsua_app.c | 84 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 6 deletions(-) (limited to 'pjsip-apps') diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index f0380fd5..ceb97e3d 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -1909,14 +1909,15 @@ static void keystroke_help(void) puts("| h Hangup call (ha=all) | s Subscribe presence | rr (Re-)register |"); puts("| H Hold call | u Unsubscribe presence | ru Unregister |"); puts("| v re-inVite (release hold) | t ToGgle Online status | > Cycle next ac.|"); - puts("| ] Select next dialog | T Set online status | < Cycle prev ac.|"); - puts("| [ Select previous dialog +--------------------------+-------------------+"); + puts("| U send UPDATE | T Set online status | < Cycle prev ac.|"); + puts("| ],[ Select next/prev call +--------------------------+-------------------+"); puts("| x Xfer call | Media Commands: | Status & Config: |"); puts("| X Xfer with Replaces | | |"); - puts("| # Send DTMF string | cl List ports | d Dump status |"); - puts("| dq Dump curr. call quality | cc Connect port | dd Dump detailed |"); - puts("| | cd Disconnect port | dc Dump config |"); - puts("| S Send arbitrary REQUEST | V Adjust audio Volume | f Save config |"); + puts("| # Send RFC 2833 DTMF | cl List ports | d Dump status |"); + puts("| * Send DTMF with INFO | cc Connect port | dd Dump detailed |"); + puts("| dq Dump curr. call quality | cd Disconnect port | dc Dump config |"); + puts("| | V Adjust audio Volume | f Save config |"); + puts("| S Send arbitrary REQUEST | Cp Codec priorities | f Save config |"); puts("+------------------------------+--------------------------+-------------------+"); puts("| q QUIT sleep N: console sleep for N ms |"); puts("+=============================================================================+"); @@ -2188,6 +2189,58 @@ static void change_online_status(void) } +/* + * Change codec priorities. + */ +static void manage_codec_prio(void) +{ + pjsua_codec_info c[32]; + unsigned i, count = PJ_ARRAY_SIZE(c); + char input[32]; + char *codec, *prio; + pj_str_t id; + int new_prio; + pj_status_t status; + + printf("List of codecs:\n"); + + pjsua_enum_codecs(c, &count); + for (i=0; i PJMEDIA_CODEC_PRIO_HIGHEST) + new_prio = PJMEDIA_CODEC_PRIO_HIGHEST; + + status = pjsua_codec_set_priority(pj_cstr(&id, codec), + (pj_uint8_t)new_prio); + if (status != PJ_SUCCESS) + pjsua_perror(THIS_FILE, "Error setting codec priority", status); +} + + /* * Main "user interface" loop. */ @@ -2611,6 +2664,25 @@ void console_app_main(const pj_str_t *uri_to_call) } break; + case 'U': + /* + * Send UPDATE + */ + if (current_call != -1) { + + pjsua_call_update(current_call, 0, NULL); + + } else { + PJ_LOG(3,(THIS_FILE, "No current call")); + } + break; + + case 'C': + if (menuin[1] == 'p') { + manage_codec_prio(); + } + break; + case 'x': /* * Transfer call. -- cgit v1.2.3