Changeset 1471
- Timestamp:
- Oct 4, 2007 6:17:58 AM (17 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r1463 r1471 1910 1910 puts("| H Hold call | u Unsubscribe presence | ru Unregister |"); 1911 1911 puts("| v re-inVite (release hold) | t ToGgle Online status | > Cycle next ac.|"); 1912 puts("| ] Select next dialog| T Set online status | < Cycle prev ac.|");1913 puts("| [ Select previous dialog+--------------------------+-------------------+");1912 puts("| U send UPDATE | T Set online status | < Cycle prev ac.|"); 1913 puts("| ],[ Select next/prev call +--------------------------+-------------------+"); 1914 1914 puts("| x Xfer call | Media Commands: | Status & Config: |"); 1915 1915 puts("| X Xfer with Replaces | | |"); 1916 puts("| # Send DTMF string | cl List ports | d Dump status |"); 1917 puts("| dq Dump curr. call quality | cc Connect port | dd Dump detailed |"); 1918 puts("| | cd Disconnect port | dc Dump config |"); 1919 puts("| S Send arbitrary REQUEST | V Adjust audio Volume | f Save config |"); 1916 puts("| # Send RFC 2833 DTMF | cl List ports | d Dump status |"); 1917 puts("| * Send DTMF with INFO | cc Connect port | dd Dump detailed |"); 1918 puts("| dq Dump curr. call quality | cd Disconnect port | dc Dump config |"); 1919 puts("| | V Adjust audio Volume | f Save config |"); 1920 puts("| S Send arbitrary REQUEST | Cp Codec priorities | f Save config |"); 1920 1921 puts("+------------------------------+--------------------------+-------------------+"); 1921 1922 puts("| q QUIT sleep N: console sleep for N ms |"); … … 2190 2191 2191 2192 /* 2193 * Change codec priorities. 2194 */ 2195 static void manage_codec_prio(void) 2196 { 2197 pjsua_codec_info c[32]; 2198 unsigned i, count = PJ_ARRAY_SIZE(c); 2199 char input[32]; 2200 char *codec, *prio; 2201 pj_str_t id; 2202 int new_prio; 2203 pj_status_t status; 2204 2205 printf("List of codecs:\n"); 2206 2207 pjsua_enum_codecs(c, &count); 2208 for (i=0; i<count; ++i) { 2209 printf(" %d\t%.*s\n", c[i].priority, (int)c[i].codec_id.slen, 2210 c[i].codec_id.ptr); 2211 } 2212 2213 puts(""); 2214 puts("Enter codec name and its new priority (e.g. \"speex/16000 200\"), empty to cancel:"); 2215 2216 printf("Codec name and priority: "); 2217 fgets(input, sizeof(input), stdin); 2218 if (input[0]=='\r' || input[0]=='\n') { 2219 puts("Done"); 2220 return; 2221 } 2222 2223 codec = strtok(input, " \t\r\n"); 2224 prio = strtok(NULL, " \r\n"); 2225 2226 if (!codec || !prio) { 2227 puts("Invalid input"); 2228 return; 2229 } 2230 2231 new_prio = atoi(prio); 2232 if (new_prio < 0) 2233 new_prio = 0; 2234 else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST) 2235 new_prio = PJMEDIA_CODEC_PRIO_HIGHEST; 2236 2237 status = pjsua_codec_set_priority(pj_cstr(&id, codec), 2238 (pj_uint8_t)new_prio); 2239 if (status != PJ_SUCCESS) 2240 pjsua_perror(THIS_FILE, "Error setting codec priority", status); 2241 } 2242 2243 2244 /* 2192 2245 * Main "user interface" loop. 2193 2246 */ … … 2612 2665 break; 2613 2666 2667 case 'U': 2668 /* 2669 * Send UPDATE 2670 */ 2671 if (current_call != -1) { 2672 2673 pjsua_call_update(current_call, 0, NULL); 2674 2675 } else { 2676 PJ_LOG(3,(THIS_FILE, "No current call")); 2677 } 2678 break; 2679 2680 case 'C': 2681 if (menuin[1] == 'p') { 2682 manage_codec_prio(); 2683 } 2684 break; 2685 2614 2686 case 'x': 2615 2687 /* -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r1463 r1471 2766 2766 const pjsua_msg_data *msg_data); 2767 2767 2768 /** 2769 * Send UPDATE request. 2770 * 2771 * @param call_id Call identification. 2772 * @param options Must be zero for now. 2773 * @param msg_data Optional message components to be sent with 2774 * the request. 2775 * 2776 * @return PJ_SUCCESS on success, or the appropriate error code. 2777 */ 2778 PJ_DECL(pj_status_t) pjsua_call_update(pjsua_call_id call_id, 2779 unsigned options, 2780 const pjsua_msg_data *msg_data); 2768 2781 2769 2782 /** -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r1469 r1471 1272 1272 if (status != PJ_SUCCESS) { 1273 1273 pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); 1274 pjsip_dlg_dec_lock(dlg); 1275 return status; 1276 } 1277 1278 pjsip_dlg_dec_lock(dlg); 1279 1280 return PJ_SUCCESS; 1281 } 1282 1283 1284 /* 1285 * Send UPDATE request. 1286 */ 1287 PJ_DEF(pj_status_t) pjsua_call_update( pjsua_call_id call_id, 1288 unsigned options, 1289 const pjsua_msg_data *msg_data) 1290 { 1291 pjmedia_sdp_session *sdp; 1292 pjsip_tx_data *tdata; 1293 pjsua_call *call; 1294 pjsip_dialog *dlg; 1295 pj_status_t status; 1296 1297 PJ_UNUSED_ARG(options); 1298 1299 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1300 PJ_EINVAL); 1301 1302 status = acquire_call("pjsua_call_update()", call_id, &call, &dlg); 1303 if (status != PJ_SUCCESS) 1304 return status; 1305 1306 /* Init media channel */ 1307 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC); 1308 if (status != PJ_SUCCESS) { 1309 pjsua_perror(THIS_FILE, "Error initializing media channel", status); 1310 pjsip_dlg_dec_lock(dlg); 1311 return PJSIP_ESESSIONSTATE; 1312 } 1313 1314 /* Create SDP */ 1315 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &sdp); 1316 if (status != PJ_SUCCESS) { 1317 pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint", 1318 status); 1319 pjsip_dlg_dec_lock(dlg); 1320 return status; 1321 } 1322 1323 /* Create re-INVITE with new offer */ 1324 status = pjsip_inv_update(call->inv, NULL, sdp, &tdata); 1325 if (status != PJ_SUCCESS) { 1326 pjsua_perror(THIS_FILE, "Unable to create UPDATE request", status); 1327 pjsip_dlg_dec_lock(dlg); 1328 return status; 1329 } 1330 1331 /* Add additional headers etc */ 1332 pjsua_process_msg_data( tdata, msg_data); 1333 1334 /* Send the request */ 1335 status = pjsip_inv_send_msg( call->inv, tdata); 1336 if (status != PJ_SUCCESS) { 1337 pjsua_perror(THIS_FILE, "Unable to send UPDAT Erequest", status); 1274 1338 pjsip_dlg_dec_lock(dlg); 1275 1339 return status;
Note: See TracChangeset
for help on using the changeset viewer.