Changeset 269
- Timestamp:
- Mar 2, 2006 9:19:55 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip-apps
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/build
- Property svn:ignore
-
old new 2 2 *.opt 3 3 *.plg 4 *.log 4 5 .*
-
- Property svn:ignore
-
pjproject/trunk/pjsip-apps/src/pjsua/main.c
r258 r269 84 84 * Notify UI when invite state has changed. 85 85 */ 86 void pjsua_ui_ inv_on_state_changed(int call_index, pjsip_event *e)86 void pjsua_ui_on_call_state(int call_index, pjsip_event *e) 87 87 { 88 88 pjsua_call *call = &pjsua.calls[call_index]; … … 111 111 * Notify UI when registration status has changed. 112 112 */ 113 void pjsua_ui_ regc_on_state_changed(int code)114 { 115 PJ_UNUSED_ARG( code);113 void pjsua_ui_on_reg_state(int acc_index) 114 { 115 PJ_UNUSED_ARG(acc_index); 116 116 117 117 // Log already written. 118 } 119 120 121 /** 122 * Incoming IM message (i.e. MESSAGE request)! 123 */ 124 void pjsua_ui_on_pager(int call_index, const pj_str_t *from, 125 const pj_str_t *to, const pj_str_t *text) 126 { 127 /* Note: call index may be -1 */ 128 PJ_UNUSED_ARG(call_index); 129 PJ_UNUSED_ARG(to); 130 131 PJ_LOG(3,(THIS_FILE,"MESSAGE from %.*s: %.*s", 132 (int)from->slen, from->ptr, 133 (int)text->slen, text->ptr)); 134 } 135 136 137 /** 138 * Typing indication 139 */ 140 void pjsua_ui_on_typing(int call_index, const pj_str_t *from, 141 const pj_str_t *to, pj_bool_t is_typing) 142 { 143 PJ_UNUSED_ARG(call_index); 144 PJ_UNUSED_ARG(to); 145 146 PJ_LOG(3,(THIS_FILE, "IM indication: %.*s %s", 147 (int)from->slen, from->ptr, 148 (is_typing?"is typing..":"has stopped typing"))); 118 149 } 119 150 … … 309 340 result->nb_result = atoi(buf); 310 341 311 if (result->nb_result > 0 && result->nb_result <= (int)pjsua.buddy_cnt) {312 --result->nb_result;342 if (result->nb_result >= 0 && result->nb_result <= (int)pjsua.buddy_cnt) { 343 result->nb_result; 313 344 return; 314 345 } … … 369 400 char menuin[10]; 370 401 char buf[128]; 402 char text[128]; 371 403 int i, count; 372 404 char *uri; … … 388 420 printf("(You currently have %d calls)\n", pjsua.call_cnt); 389 421 422 uri = NULL; 390 423 ui_input_url("Make call", buf, sizeof(buf), &result); 391 424 if (result.nb_result != NO_NB) { 392 if (result.nb_result == -1) 425 426 if (result.nb_result == -1 || result.nb_result == 0) { 393 427 puts("You can't do that with make call!"); 394 else 395 pjsua_make_call( current_acc, 396 pjsua.buddies[result.nb_result].uri.ptr, 397 NULL); 398 } else if (result.uri_result) 399 pjsua_make_call( current_acc, result.uri_result, NULL); 428 continue; 429 } else { 430 uri = pjsua.buddies[result.nb_result-1].uri.ptr; 431 } 432 433 } else if (result.uri_result) { 434 uri = result.uri_result; 435 } 400 436 437 pjsua_make_call( current_acc, uri, NULL); 401 438 break; 402 439 … … 414 451 ui_input_url("Make call", buf, sizeof(buf), &result); 415 452 if (result.nb_result != NO_NB) { 416 if (result.nb_result == -1 ) {453 if (result.nb_result == -1 || result.nb_result == 0) { 417 454 puts("You can't do that with make call!"); 418 455 continue; 419 456 } 420 uri = pjsua.buddies[result.nb_result ].uri.ptr;457 uri = pjsua.buddies[result.nb_result-1].uri.ptr; 421 458 } else { 422 459 uri = result.uri_result; … … 430 467 break; 431 468 } 469 break; 470 471 case 'i': 472 /* Send instant messaeg */ 473 474 /* i is for call index to send message, if any */ 475 i = -1; 476 477 /* Make compiler happy. */ 478 uri = NULL; 479 480 /* Input destination. */ 481 ui_input_url("Send IM to", buf, sizeof(buf), &result); 482 if (result.nb_result != NO_NB) { 483 484 if (result.nb_result == -1) { 485 puts("You can't send broadcast IM like that!"); 486 continue; 487 488 } else if (result.nb_result == 0) { 489 490 i = current_call; 491 492 } else { 493 uri = pjsua.buddies[result.nb_result-1].uri.ptr; 494 } 495 496 } else if (result.uri_result) { 497 uri = result.uri_result; 498 } 499 500 501 /* Send typing indication. */ 502 if (i != -1) 503 pjsua_call_typing(i, PJ_TRUE); 504 else 505 pjsua_im_typing(current_acc, uri, PJ_TRUE); 506 507 /* Input the IM . */ 508 if (!simple_input("Message", text, sizeof(text))) { 509 /* 510 * Cancelled. 511 * Send typing notification too, saying we're not typing. 512 */ 513 if (i != -1) 514 pjsua_call_typing(i, PJ_FALSE); 515 else 516 pjsua_im_typing(current_acc, uri, PJ_FALSE); 517 continue; 518 } 519 520 /* Send the IM */ 521 if (i != -1) 522 pjsua_call_send_im(i, text); 523 else 524 pjsua_im_send(current_acc, uri, text); 525 432 526 break; 433 527 … … 576 670 577 671 if (result.nb_result != NO_NB) { 578 if (result.nb_result == -1 )672 if (result.nb_result == -1 || result.nb_result == 0) 579 673 puts("You can't do that with transfer call!"); 580 674 else 581 675 pjsua_call_xfer( current_call, 582 pjsua.buddies[result.nb_result ].uri.ptr);676 pjsua.buddies[result.nb_result-1].uri.ptr); 583 677 584 678 } else if (result.uri_result) { … … 638 732 for (i=0; i<pjsua.buddy_cnt; ++i) 639 733 pjsua.buddies[i].monitor = (menuin[0]=='s'); 734 } else if (result.nb_result == 0) { 735 puts("Sorry, can only subscribe to buddy's presence, " 736 "not from existing call"); 640 737 } else { 641 pjsua.buddies[result.nb_result ].monitor = (menuin[0]=='s');738 pjsua.buddies[result.nb_result-1].monitor = (menuin[0]=='s'); 642 739 } 643 740 … … 671 768 pjsua.acc[current_acc].online_status = 672 769 !pjsua.acc[current_acc].online_status; 770 printf("Setting %s online status to %s\n", 771 pjsua.acc[current_acc].local_uri.ptr, 772 (pjsua.acc[current_acc].online_status?"online":"offline")); 673 773 pjsua_pres_refresh(current_acc); 674 774 break; … … 741 841 742 842 default: 843 if (menuin[0] != '\n' && menuin[0] != '\r') { 844 printf("Invalid input %s", menuin); 845 } 743 846 keystroke_help(); 744 847 break;
Note: See TracChangeset
for help on using the changeset viewer.