Changeset 201 for pjproject/trunk/pjsip/src
- Timestamp:
- Feb 19, 2006 3:37:19 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-simple/evsub.c
r198 r201 128 128 TIMER_TYPE_UAC_WAIT_NOTIFY, 129 129 130 /* Max nb of timer types. */ 131 TIMER_TYPE_MAX 130 132 }; 131 133 … … 137 139 "UAC_TERMINATE", 138 140 "UAC_WAIT_NOTIFY", 141 "INVALID_TIMER" 139 142 }; 140 143 … … 250 253 { 251 254 pj_status_t status; 255 pj_str_t method_tags[] = { 256 { "SUBSCRIBE", 9}, 257 { "NOTIFY", 6} 258 }; 252 259 253 260 PJ_ASSERT_RETURN(endpt != NULL, PJ_EINVAL); … … 276 283 pjsip_evsub_init_parser(); 277 284 285 /* Register new methods SUBSCRIBE and NOTIFY in Allow-ed header */ 286 pjsip_endpt_add_capability(endpt, &mod_evsub.mod, PJSIP_H_ALLOW, NULL, 287 2, method_tags); 288 289 /* Done. */ 278 290 return PJ_SUCCESS; 279 291 … … 437 449 438 450 PJ_ASSERT_ON_FAIL(seconds > 0, return); 451 PJ_ASSERT_ON_FAIL(timer_id>TIMER_TYPE_NONE && timer_id<TIMER_TYPE_MAX, 452 return); 439 453 440 454 timeout.sec = seconds; -
pjproject/trunk/pjsip/src/pjsip-simple/xpidf.c
r197 r201 30 30 static pj_str_t ATOM = { "atom", 4 }; 31 31 static pj_str_t ATOMID = { "atomid", 6 }; 32 static pj_str_t ID = { "id", 2 }; 32 33 static pj_str_t ADDRESS = { "address", 7 }; 33 34 static pj_str_t SUBSCRIBE_PARAM = { ";method=SUBSCRIBE", 17 }; … … 127 128 if (pj_stricmp(&pres->name, &PRESENCE) != 0) 128 129 return NULL; 129 if (pj_xml_find_attr(pres, &URI, NULL) == NULL)130 return NULL;131 130 132 131 /* Validate <presentity> */ … … 134 133 if (node == NULL) 135 134 return NULL; 135 if (pj_xml_find_attr(node, &URI, NULL) == NULL) 136 return NULL; 136 137 137 138 /* Validate <atom> */ … … 139 140 if (node == NULL) 140 141 return NULL; 141 if (pj_xml_find_attr(node, &ATOMID, NULL) == NULL) 142 return NULL; 142 if (pj_xml_find_attr(node, &ATOMID, NULL) == NULL && 143 pj_xml_find_attr(node, &ID, NULL) == NULL) 144 { 145 return NULL; 146 } 143 147 144 148 /* Address */ … … 247 251 return PJ_FALSE; 248 252 } 249 status = pj_xml_find_node(a tom, &STATUS);253 status = pj_xml_find_node(addr, &STATUS); 250 254 if (!status) { 251 255 pj_assert(0); … … 258 262 } 259 263 260 return pj_stricmp(&attr->value, &OPEN) ? PJ_TRUE : PJ_FALSE;264 return pj_stricmp(&attr->value, &OPEN)==0 ? PJ_TRUE : PJ_FALSE; 261 265 } 262 266 -
pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
r167 r201 26 26 #include <pjsip/sip_auth_msg.h> 27 27 #include <pjsip/sip_errno.h> 28 #include <pj/assert.h> 29 #include <pj/guid.h> 30 #include <pj/os.h> 28 31 #include <pj/pool.h> 32 #include <pj/log.h> 29 33 #include <pj/string.h> 30 #include <pj/guid.h>31 #include <pj/log.h>32 #include <pj/assert.h>33 34 34 35 … … 54 55 pjsip_cid_hdr *cid_hdr; 55 56 pjsip_cseq_hdr *cseq_hdr; 57 pj_str_t from_uri; 56 58 pjsip_from_hdr *from_hdr; 57 59 pjsip_to_hdr *to_hdr; … … 69 71 /* Auto refresh registration. */ 70 72 pj_bool_t auto_reg; 73 pj_time_val last_reg; 74 pj_time_val next_reg; 71 75 pj_timer_entry timer; 72 76 }; … … 111 115 PJ_DEF(pj_status_t) pjsip_regc_destroy(pjsip_regc *regc) 112 116 { 117 PJ_ASSERT_RETURN(regc, PJ_EINVAL); 118 113 119 if (regc->pending_tsx) { 114 120 regc->_delete_flag = 1; … … 116 122 } else { 117 123 pjsip_endpt_release_pool(regc->endpt, regc->pool); 124 } 125 126 return PJ_SUCCESS; 127 } 128 129 130 PJ_DEF(pj_status_t) pjsip_regc_get_info( pjsip_regc *regc, 131 pjsip_regc_info *info ) 132 { 133 PJ_ASSERT_RETURN(regc && info, PJ_EINVAL); 134 135 info->server_uri = regc->str_srv_url; 136 info->client_uri = regc->from_uri; 137 info->is_busy = (regc->pending_tsx != 0); 138 info->auto_reg = regc->auto_reg; 139 info->interval = regc->expires; 140 141 if (regc->pending_tsx) 142 info->next_reg = 0; 143 else if (regc->auto_reg == 0) 144 info->next_reg = 0; 145 else if (regc->expires < 0) 146 info->next_reg = regc->expires; 147 else { 148 pj_time_val now, next_reg; 149 150 next_reg = regc->next_reg; 151 pj_gettimeofday(&now); 152 PJ_TIME_VAL_SUB(next_reg, now); 153 info->next_reg = next_reg.sec; 118 154 } 119 155 … … 195 231 196 232 /* Set "From" header. */ 197 pj_strdup_with_null(regc->pool, &tmp, from_url); 233 pj_strdup_with_null(regc->pool, ®c->from_uri, from_url); 234 tmp = regc->from_uri; 198 235 regc->from_hdr = pjsip_from_hdr_create(regc->pool); 199 236 regc->from_hdr->uri = pjsip_parse_uri(regc->pool, tmp.ptr, tmp.slen, … … 326 363 pjsip_tx_data *tdata; 327 364 365 PJ_ASSERT_RETURN(regc && p_tdata, PJ_EINVAL); 366 328 367 status = create_request(regc, &tdata); 329 368 if (status != PJ_SUCCESS) … … 356 395 pj_status_t status; 357 396 397 PJ_ASSERT_RETURN(regc && p_tdata, PJ_EINVAL); 398 358 399 if (regc->timer.id != 0) { 359 400 pjsip_endpt_cancel_timer(regc->endpt, ®c->timer); … … 378 419 const pj_str_t contact[] ) 379 420 { 421 PJ_ASSERT_RETURN(regc, PJ_EINVAL); 380 422 return set_contact( regc, contact_cnt, contact ); 381 423 } … … 385 427 pj_uint32_t expires ) 386 428 { 429 PJ_ASSERT_RETURN(regc, PJ_EINVAL); 387 430 set_expires( regc, expires ); 388 431 return PJ_SUCCESS; … … 390 433 391 434 392 static void call_callback(pjsip_regc *regc, int status, const pj_str_t *reason, 435 static void call_callback(pjsip_regc *regc, pj_status_t status, int st_code, 436 const pj_str_t *reason, 393 437 pjsip_rx_data *rdata, pj_int32_t expiration, 394 438 int contact_cnt, pjsip_contact_hdr *contact[]) … … 399 443 cbparam.regc = regc; 400 444 cbparam.token = regc->token; 401 cbparam.code = status; 445 cbparam.status = status; 446 cbparam.code = st_code; 402 447 cbparam.reason = *reason; 403 448 cbparam.rdata = rdata; … … 428 473 char errmsg[PJ_ERR_MSG_SIZE]; 429 474 pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg)); 430 call_callback(regc, -1, &reason, NULL, -1, 0, NULL);475 call_callback(regc, status, 400, &reason, NULL, -1, 0, NULL); 431 476 } 432 477 } … … 438 483 pjsip_transaction *tsx = event->body.tsx_state.tsx; 439 484 485 /* Decrement pending transaction counter. */ 486 --regc->pending_tsx; 487 440 488 /* If registration data has been deleted by user then remove registration 441 489 * data from transaction's callback, and don't call callback. 442 490 */ 443 491 if (regc->_delete_flag) { 444 --regc->pending_tsx; 492 493 /* Nothing to do */ 494 ; 445 495 446 496 } else if (tsx->status_code == PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED || … … 456 506 457 507 if (status == PJ_SUCCESS) { 458 --regc->pending_tsx;459 508 pjsip_regc_send(regc, tdata); 460 509 return; 461 510 } else { 462 call_callback(regc, tsx->status_code, &rdata->msg_info.msg->line.status.reason, 511 call_callback(regc, status, tsx->status_code, 512 &rdata->msg_info.msg->line.status.reason, 463 513 rdata, -1, 0, NULL); 464 --regc->pending_tsx;465 514 } 466 515 } else { … … 513 562 regc->timer.user_data = regc; 514 563 pjsip_endpt_schedule_timer( regc->endpt, ®c->timer, &delay); 564 pj_gettimeofday(®c->last_reg); 565 regc->next_reg = regc->last_reg; 566 regc->next_reg.sec += delay.sec; 515 567 } 516 568 … … 523 575 /* Call callback. */ 524 576 if (expiration == 0xFFFF) expiration = -1; 525 call_callback(regc, tsx->status_code,577 call_callback(regc, PJ_SUCCESS, tsx->status_code, 526 578 (rdata ? &rdata->msg_info.msg->line.status.reason 527 579 : pjsip_get_status_text(tsx->status_code)), … … 529 581 contact_cnt, contact); 530 582 531 --regc->pending_tsx;532 583 } 533 584 … … 544 595 /* Make sure we don't have pending transaction. */ 545 596 if (regc->pending_tsx) { 546 pj_str_t reason = pj_str("Transaction in progress");547 call_callback(regc, -1, &reason, NULL, -1, 0, NULL);548 597 pjsip_tx_data_dec_ref( tdata ); 549 return PJ _EINVALIDOP;598 return PJSIP_EBUSY; 550 599 } 551 600 … … 560 609 if (status==PJ_SUCCESS) 561 610 ++regc->pending_tsx; 562 else {563 char errmsg[PJ_ERR_MSG_SIZE];564 pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg));565 call_callback(regc, status, &reason, NULL, -1, 0, NULL);566 }567 611 568 612 return status; -
pjproject/trunk/pjsip/src/pjsua/main.c
r197 r201 99 99 static void keystroke_help(void) 100 100 { 101 102 printf(">>>>\nOnline status: %s\n", 101 char reg_status[128]; 102 103 if (pjsua.regc == NULL) { 104 pj_ansi_strcpy(reg_status, " -not registered to server-"); 105 } else if (pjsua.regc_last_err != PJ_SUCCESS) { 106 pj_strerror(pjsua.regc_last_err, reg_status, sizeof(reg_status)); 107 } else if (pjsua.regc_last_code>=200 && pjsua.regc_last_code<=699) { 108 109 pjsip_regc_info info; 110 111 pjsip_regc_get_info(pjsua.regc, &info); 112 113 pj_snprintf(reg_status, sizeof(reg_status), 114 "%s (%.*s;expires=%d)", 115 pjsip_get_status_text(pjsua.regc_last_code)->ptr, 116 (int)info.server_uri.slen, 117 info.server_uri.ptr, 118 info.next_reg); 119 120 } else { 121 pj_sprintf(reg_status, "in progress (%d)", pjsua.regc_last_code); 122 } 123 124 printf(">>>>\nRegistration status: %s\n", reg_status); 125 printf("Online status: %s\n", 103 126 (pjsua.online_status ? "Online" : "Invisible")); 104 127 print_buddy_list(); … … 109 132 puts("| | | |"); 110 133 puts("| m Make new call | i Send IM | o Send OPTIONS |"); 111 puts("| a Answer call | s Subscribe presence | d Dump status|");112 puts("| h Hangup call | u Unsubscribe presence | d1 Dump detailed|");113 puts("| ] Select next dialog | t Toggle Online status | 134 puts("| a Answer call | s Subscribe presence | R (Re-)register |"); 135 puts("| h Hangup call | u Unsubscribe presence | r Unregister |"); 136 puts("| ] Select next dialog | t Toggle Online status | d Dump status |"); 114 137 puts("| [ Select previous dialog | | |"); 115 138 puts("+-----------------------------------------------------------------------------+"); … … 224 247 225 248 if ((status=pjsua_verify_sip_url(buf)) != PJ_SUCCESS) { 226 pjsua_perror( "Invalid URL", status);249 pjsua_perror(THIS_FILE, "Invalid URL", status); 227 250 return; 228 251 } … … 291 314 292 315 if (status != PJ_SUCCESS) 293 pjsua_perror("Unable to create/send response", status); 316 pjsua_perror(THIS_FILE, "Unable to create/send response", 317 status); 294 318 } 295 319 … … 311 335 PJSIP_SC_DECLINE, NULL, &tdata); 312 336 if (status != PJ_SUCCESS) { 313 pjsua_perror("Failed to create end session message", status); 337 pjsua_perror(THIS_FILE, 338 "Failed to create end session message", 339 status); 314 340 continue; 315 341 } … … 317 343 status = pjsip_inv_send_msg(inv_session->inv, tdata, NULL); 318 344 if (status != PJ_SUCCESS) { 319 pjsua_perror("Failed to send end session message", status); 345 pjsua_perror(THIS_FILE, 346 "Failed to send end session message", 347 status); 320 348 continue; 321 349 } … … 353 381 } 354 382 383 break; 384 385 case 'R': 386 pjsua_regc_update(PJ_TRUE); 387 break; 388 389 case 'r': 390 pjsua_regc_update(PJ_FALSE); 355 391 break; 356 392 … … 501 537 * Display error message for the specified error code. 502 538 */ 503 void pjsua_perror(const char *title, pj_status_t status) 539 void pjsua_perror(const char *sender, const char *title, 540 pj_status_t status) 504 541 { 505 542 char errmsg[PJ_ERR_MSG_SIZE]; … … 507 544 pj_strerror(status, errmsg, sizeof(errmsg)); 508 545 509 PJ_LOG(1,( THIS_FILE, "%s: %s [code=%d]", title, errmsg, status));546 PJ_LOG(1,(sender, "%s: %s [code=%d]", title, errmsg, status)); 510 547 } 511 548 -
pjproject/trunk/pjsip/src/pjsua/pjsua.h
r197 r201 128 128 pj_int32_t reg_timeout; 129 129 pj_timer_entry regc_timer; 130 pj_status_t regc_last_err; /**< Last registration error. */ 130 131 int regc_last_code;/**< Last status last register. */ 131 132 … … 200 201 * Display error message for the specified error code. 201 202 */ 202 void pjsua_perror(const char *title, pj_status_t status); 203 void pjsua_perror(const char *sender, const char *title, 204 pj_status_t status); 203 205 204 206 -
pjproject/trunk/pjsip/src/pjsua/pjsua_core.c
r197 r201 73 73 pjsua.local_uri = pj_str(PJSUA_LOCAL_URI); 74 74 75 /* Default registration timeout: */ 76 77 pjsua.reg_timeout = 55; 78 75 79 /* Init route set list: */ 76 80 … … 156 160 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &sock[SIP_SOCK]); 157 161 if (status != PJ_SUCCESS) { 158 pjsua_perror( "socket() error", status);162 pjsua_perror(THIS_FILE, "socket() error", status); 159 163 goto on_error; 160 164 } … … 162 166 status = pj_sock_bind_in(sock[SIP_SOCK], 0, pjsua.sip_port); 163 167 if (status != PJ_SUCCESS) { 164 pjsua_perror( "bind() error", status);168 pjsua_perror(THIS_FILE, "bind() error", status); 165 169 goto on_error; 166 170 } … … 175 179 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &sock[RTP_SOCK]); 176 180 if (status != PJ_SUCCESS) { 177 pjsua_perror( "socket() error", status);181 pjsua_perror(THIS_FILE, "socket() error", status); 178 182 goto on_error; 179 183 } … … 189 193 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &sock[RTCP_SOCK]); 190 194 if (status != PJ_SUCCESS) { 191 pjsua_perror( "socket() error", status);195 pjsua_perror(THIS_FILE, "socket() error", status); 192 196 goto on_error; 193 197 } … … 218 222 status = pj_sockaddr_in_set_str_addr( &addr, hostname); 219 223 if (status != PJ_SUCCESS) { 220 pjsua_perror("Unresolvable local hostname", status); 224 pjsua_perror(THIS_FILE, "Unresolvable local hostname", 225 status); 221 226 goto on_error; 222 227 } … … 235 240 mapped_addr); 236 241 if (status != PJ_SUCCESS) { 237 pjsua_perror( "STUN error", status);242 pjsua_perror(THIS_FILE, "STUN error", status); 238 243 goto on_error; 239 244 } … … 311 316 &pjsua.endpt); 312 317 if (status != PJ_SUCCESS) { 313 pjsua_perror( "Unable to create SIP endpoint", status);318 pjsua_perror(THIS_FILE, "Unable to create SIP endpoint", status); 314 319 return status; 315 320 } … … 321 326 status = pjsip_tsx_layer_init(pjsua.endpt); 322 327 if (status != PJ_SUCCESS) { 323 pjsua_perror("Transaction layer initialization error", status); 328 pjsua_perror(THIS_FILE, "Transaction layer initialization error", 329 status); 324 330 goto on_error; 325 331 } … … 329 335 status = pjsip_ua_init( pjsua.endpt, NULL ); 330 336 if (status != PJ_SUCCESS) { 331 pjsua_perror( "UA layer initialization error", status);337 pjsua_perror(THIS_FILE, "UA layer initialization error", status); 332 338 goto on_error; 333 339 } … … 358 364 status = pjsip_endpt_register_module(pjsua.endpt, &pjsua.mod); 359 365 if (status != PJ_SUCCESS) { 360 pjsua_perror("Unable to register pjsua module", status); 366 pjsua_perror(THIS_FILE, "Unable to register pjsua module", 367 status); 361 368 goto on_error; 362 369 } … … 378 385 status = pjsip_inv_usage_init(pjsua.endpt, &pjsua.mod, &inv_cb); 379 386 if (status != PJ_SUCCESS) { 380 pjsua_perror("Invite usage initialization error", status); 387 pjsua_perror(THIS_FILE, "Invite usage initialization error", 388 status); 381 389 goto on_error; 382 390 } … … 428 436 status = pj_init(); 429 437 if (status != PJ_SUCCESS) { 430 pjsua_perror( "pj_init() error", status);438 pjsua_perror(THIS_FILE, "pj_init() error", status); 431 439 return status; 432 440 } … … 446 454 if (status != PJ_SUCCESS) { 447 455 pj_caching_pool_destroy(&pjsua.cp); 448 pjsua_perror("Stack initialization has returned error", status); 456 pjsua_perror(THIS_FILE, "Stack initialization has returned error", 457 status); 449 458 return status; 450 459 } … … 470 479 if (status != PJ_SUCCESS) { 471 480 pj_caching_pool_destroy(&pjsua.cp); 472 pjsua_perror("Media stack initialization has returned error", status); 481 pjsua_perror(THIS_FILE, 482 "Media stack initialization has returned error", 483 status); 473 484 return status; 474 485 } … … 479 490 if (status != PJ_SUCCESS) { 480 491 pj_caching_pool_destroy(&pjsua.cp); 481 pjsua_perror("Media codec initialization has returned error", status); 492 pjsua_perror(THIS_FILE, 493 "Media codec initialization has returned error", 494 status); 482 495 return status; 483 496 } … … 504 517 status = init_sockets(); 505 518 if (status != PJ_SUCCESS) { 506 pjsua_perror("init_sockets() has returned error", status); 519 pjsua_perror(THIS_FILE, "init_sockets() has returned error", 520 status); 507 521 return status; 508 522 } … … 528 542 &udp_transport); 529 543 if (status != PJ_SUCCESS) { 530 pjsua_perror("Unable to start UDP transport", status); 544 pjsua_perror(THIS_FILE, "Unable to start UDP transport", 545 status); 531 546 return status; 532 547 } … … 553 568 pjsua.local_uri.slen, 0); 554 569 if (uri == NULL) { 555 pjsua_perror("Invalid local URI", PJSIP_EINVALIDURI); 570 pjsua_perror(THIS_FILE, "Invalid local URI", 571 PJSIP_EINVALIDURI); 556 572 return PJSIP_EINVALIDURI; 557 573 } … … 561 577 562 578 if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) { 563 pjsua_perror("Invalid local URI", PJSIP_EINVALIDSCHEME); 579 pjsua_perror(THIS_FILE, "Invalid local URI", 580 PJSIP_EINVALIDSCHEME); 564 581 return PJSIP_EINVALIDSCHEME; 565 582 } … … 595 612 596 613 if (len < 1 || len >= sizeof(contact)) { 597 pjsua_perror( "Invalid Contact", PJSIP_EURITOOLONG);614 pjsua_perror(THIS_FILE, "Invalid Contact", PJSIP_EURITOOLONG); 598 615 return PJSIP_EURITOOLONG; 599 616 } … … 618 635 &parsed_len); 619 636 if (route == NULL) { 620 pjsua_perror("Invalid outbound proxy URL", PJSIP_EINVALIDURI); 637 pjsua_perror(THIS_FILE, "Invalid outbound proxy URL", 638 PJSIP_EINVALIDURI); 621 639 return PJSIP_EINVALIDURI; 622 640 } -
pjproject/trunk/pjsip/src/pjsua/pjsua_inv.c
r197 r201 54 54 &dlg); 55 55 if (status != PJ_SUCCESS) { 56 pjsua_perror( "Dialog creation failed", status);56 pjsua_perror(THIS_FILE, "Dialog creation failed", status); 57 57 return status; 58 58 } … … 63 63 1, &pjsua.med_skinfo, &offer); 64 64 if (status != PJ_SUCCESS) { 65 pjsua_perror( "pjmedia unable to create SDP", status);65 pjsua_perror(THIS_FILE, "pjmedia unable to create SDP", status); 66 66 goto on_error; 67 67 } … … 71 71 status = pjsip_inv_create_uac( dlg, offer, 0, &inv); 72 72 if (status != PJ_SUCCESS) { 73 pjsua_perror( "Invite session creation failed", status);73 pjsua_perror(THIS_FILE, "Invite session creation failed", status); 74 74 goto on_error; 75 75 } … … 100 100 status = pjsip_inv_invite(inv, &tdata); 101 101 if (status != PJ_SUCCESS) { 102 pjsua_perror("Unable to create initial INVITE request", status); 102 pjsua_perror(THIS_FILE, "Unable to create initial INVITE request", 103 status); 103 104 goto on_error; 104 105 } … … 109 110 status = pjsip_inv_send_msg(inv, tdata, NULL); 110 111 if (status != PJ_SUCCESS) { 111 pjsua_perror("Unable to send initial INVITE request", status); 112 pjsua_perror(THIS_FILE, "Unable to send initial INVITE request", 113 status); 112 114 goto on_error; 113 115 } … … 302 304 if (status != PJ_SUCCESS) { 303 305 304 pjsua_perror( "SDP negotiation has failed", status);306 pjsua_perror(THIS_FILE, "SDP negotiation has failed", status); 305 307 return; 306 308 … … 319 321 status = pjmedia_sdp_neg_get_active_local(inv->neg, &local_sdp); 320 322 if (status != PJ_SUCCESS) { 321 pjsua_perror("Unable to retrieve currently active local SDP", status); 323 pjsua_perror(THIS_FILE, 324 "Unable to retrieve currently active local SDP", 325 status); 322 326 return; 323 327 } … … 326 330 status = pjmedia_sdp_neg_get_active_remote(inv->neg, &remote_sdp); 327 331 if (status != PJ_SUCCESS) { 328 pjsua_perror("Unable to retrieve currently active remote SDP", status); 332 pjsua_perror(THIS_FILE, 333 "Unable to retrieve currently active remote SDP", 334 status); 329 335 return; 330 336 } … … 341 347 &inv_data->session ); 342 348 if (status != PJ_SUCCESS) { 343 pjsua_perror("Unable to create media session", status); 349 pjsua_perror(THIS_FILE, "Unable to create media session", 350 status); 344 351 return; 345 352 } -
pjproject/trunk/pjsip/src/pjsua/pjsua_pres.c
r197 r201 99 99 &pjsua.contact_uri, &dlg); 100 100 if (status != PJ_SUCCESS) { 101 pjsua_perror("Unable to create UAS dialog for subscription", status); 101 pjsua_perror(THIS_FILE, 102 "Unable to create UAS dialog for subscription", 103 status); 102 104 return PJ_FALSE; 103 105 } … … 111 113 if (status != PJ_SUCCESS) { 112 114 PJ_TODO(DESTROY_DIALOG); 113 pjsua_perror("Unable to create server subscription", status); 115 pjsua_perror(THIS_FILE, "Unable to create server subscription", 116 status); 114 117 return PJ_FALSE; 115 118 } … … 135 138 status = pjsip_pres_accept(sub, rdata, 200, NULL); 136 139 if (status != PJ_SUCCESS) { 137 pjsua_perror("Unable to accept presence subscription", status); 140 pjsua_perror(THIS_FILE, "Unable to accept presence subscription", 141 status); 138 142 pj_list_erase(uapres); 139 143 return PJ_FALSE; … … 158 162 159 163 if (status != PJ_SUCCESS) { 160 pjsua_perror("Unable to create/send NOTIFY", status); 164 pjsua_perror(THIS_FILE, "Unable to create/send NOTIFY", 165 status); 161 166 pj_list_erase(uapres); 162 167 return PJ_FALSE; … … 305 310 NULL, &dlg); 306 311 if (status != PJ_SUCCESS) { 307 pjsua_perror("Unable to create dialog", status); 312 pjsua_perror(THIS_FILE, "Unable to create dialog", 313 status); 308 314 return; 309 315 } … … 313 319 if (status != PJ_SUCCESS) { 314 320 pjsua.buddies[index].sub = NULL; 315 pjsua_perror("Unable to create presence client", status); 321 pjsua_perror(THIS_FILE, "Unable to create presence client", 322 status); 316 323 return; 317 324 } … … 323 330 if (status != PJ_SUCCESS) { 324 331 pjsua.buddies[index].sub = NULL; 325 pjsua_perror("Unable to create initial SUBSCRIBE", status); 332 pjsua_perror(THIS_FILE, "Unable to create initial SUBSCRIBE", 333 status); 326 334 return; 327 335 } … … 330 338 if (status != PJ_SUCCESS) { 331 339 pjsua.buddies[index].sub = NULL; 332 pjsua_perror("Unable to send initial SUBSCRIBE", status); 340 pjsua_perror(THIS_FILE, "Unable to send initial SUBSCRIBE", 341 status); 333 342 return; 334 343 } … … 365 374 366 375 } else { 367 pjsua_perror("Unable to unsubscribe presence", status); 376 pjsua_perror(THIS_FILE, "Unable to unsubscribe presence", 377 status); 368 378 } 369 379 } … … 397 407 status = pjsip_endpt_register_module( pjsua.endpt, &mod_pjsua_pres); 398 408 if (status != PJ_SUCCESS) { 399 pjsua_perror("Unable to register pjsua presence module", status); 409 pjsua_perror(THIS_FILE, "Unable to register pjsua presence module", 410 status); 400 411 } 401 412 -
pjproject/trunk/pjsip/src/pjsua/pjsua_reg.c
r184 r201 38 38 * Print registration status. 39 39 */ 40 if (param->code < 0 || param->code >= 300) { 40 if (param->status!=PJ_SUCCESS) { 41 pjsua_perror(THIS_FILE, "SIP registration error", 42 param->status); 43 pjsua.regc = NULL; 44 45 } else if (param->code < 0 || param->code >= 300) { 41 46 PJ_LOG(2, (THIS_FILE, "SIP registration failed, status=%d (%s)", 42 param->code, pjsip_get_status_text(param->code)->ptr)); 47 param->code, 48 pjsip_get_status_text(param->code)->ptr)); 43 49 pjsua.regc = NULL; 44 50 … … 54 60 } 55 61 62 pjsua.regc_last_err = param->status; 56 63 pjsua.regc_last_code = param->code; 57 64 … … 69 76 70 77 if (renew) { 71 PJ_LOG(3,(THIS_FILE, "Performing SIP registration...")); 78 if (pjsua.regc == NULL) { 79 status = pjsua_regc_init(); 80 if (status != PJ_SUCCESS) { 81 pjsua_perror(THIS_FILE, "Unable to create registration", 82 status); 83 return; 84 } 85 } 72 86 status = pjsip_regc_register(pjsua.regc, 1, &tdata); 73 87 } else { 74 PJ_LOG(3,(THIS_FILE, "Performing SIP unregistration...")); 88 if (pjsua.regc == NULL) { 89 PJ_LOG(3,(THIS_FILE, "Currently not registered")); 90 return; 91 } 75 92 status = pjsip_regc_unregister(pjsua.regc, &tdata); 76 93 } 77 94 95 if (status == PJ_SUCCESS) 96 status = pjsip_regc_send( pjsua.regc, tdata ); 97 78 98 if (status != PJ_SUCCESS) { 79 pjsua_perror("Unable to create REGISTER request", status); 80 return; 99 pjsua_perror(THIS_FILE, "Unable to create/send REGISTER", 100 status); 101 } else { 102 PJ_LOG(3,(THIS_FILE, "%s sent", 103 (renew? "Registration" : "Unregistration"))); 81 104 } 82 83 pjsip_regc_send( pjsua.regc, tdata );84 105 } 85 106 … … 97 118 98 119 if (status != PJ_SUCCESS) { 99 pjsua_perror("Unable to create client registration", status); 120 pjsua_perror(THIS_FILE, "Unable to create client registration", 121 status); 100 122 return status; 101 123 } … … 108 130 pjsua.reg_timeout); 109 131 if (status != PJ_SUCCESS) { 110 pjsua_perror("Client registration initialization error", status); 132 pjsua_perror(THIS_FILE, 133 "Client registration initialization error", 134 status); 111 135 return status; 112 136 }
Note: See TracChangeset
for help on using the changeset viewer.