- Timestamp:
- Jun 13, 2013 8:56:51 AM (11 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r4524 r4534 1277 1277 unsigned flags); 1278 1278 1279 /** 1280 * This callback can be used by application to override the account 1281 * to be used to handle an incoming message. Initially, the account to 1282 * be used will be calculated automatically by the library. This initial 1283 * account will be used if application does not implement this callback, 1284 * or application sets an invalid account upon returning from this 1285 * callback. 1286 * 1287 * Note that currently the incoming messages requiring account assignment 1288 * are INVITE, MESSAGE, SUBSCRIBE, and unsolicited NOTIFY. This callback 1289 * may be called before the callback of the SIP event itself, i.e: 1290 * incoming call, pager, subscription, or unsolicited-event. 1291 * 1292 * @param rdata The incoming message. 1293 * @param acc_id On input, initial account ID calculated automatically 1294 * by the library. On output, the account ID prefered 1295 * by application to handle the incoming message. 1296 */ 1297 void (*on_acc_find_for_incoming)(const pjsip_rx_data *rdata, 1298 pjsua_acc_id* acc_id); 1299 1279 1300 } pjsua_callback; 1280 1301 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r4532 r4534 2618 2618 pjsip_uri *uri; 2619 2619 pjsip_sip_uri *sip_uri; 2620 pjsua_acc_id id = PJSUA_INVALID_ID; 2620 2621 unsigned i; 2621 2622 … … 2624 2625 2625 2626 uri = rdata->msg_info.to->uri; 2627 2628 PJSUA_LOCK(); 2626 2629 2627 2630 /* Use Req URI if To URI is not SIP */ … … 2632 2635 uri = rdata->msg_info.msg->line.req.uri; 2633 2636 else 2634 return pjsua_var.default_acc;2637 goto on_return; 2635 2638 } 2636 2639 … … 2639 2642 !PJSIP_URI_SCHEME_IS_SIPS(uri)) 2640 2643 { 2641 return pjsua_var.default_acc; 2642 } 2643 2644 2645 PJSUA_LOCK(); 2644 goto on_return; 2645 } 2646 2646 2647 2647 sip_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(uri); … … 2656 2656 { 2657 2657 /* Match ! */ 2658 PJSUA_UNLOCK();2659 return acc_id;2658 id = acc_id; 2659 goto on_return; 2660 2660 } 2661 2661 } … … 2668 2668 if (acc->valid && pj_stricmp(&acc->srv_domain, &sip_uri->host)==0) { 2669 2669 /* Match ! */ 2670 PJSUA_UNLOCK();2671 return acc_id;2670 id = acc_id; 2671 goto on_return; 2672 2672 } 2673 2673 } … … 2691 2691 2692 2692 /* Match ! */ 2693 PJSUA_UNLOCK(); 2694 return acc_id; 2695 } 2696 } 2693 id = acc_id; 2694 goto on_return; 2695 } 2696 } 2697 2698 on_return: 2699 PJSUA_UNLOCK(); 2697 2700 2698 2701 /* Still no match, use default account */ 2699 PJSUA_UNLOCK(); 2700 return pjsua_var.default_acc; 2702 if (id == PJSUA_INVALID_ID) 2703 id = pjsua_var.default_acc; 2704 2705 /* Invoke account find callback */ 2706 if (pjsua_var.ua_cfg.cb.on_acc_find_for_incoming) 2707 (*pjsua_var.ua_cfg.cb.on_acc_find_for_incoming)(rdata, &id); 2708 2709 /* Verify if the specified account id is valid */ 2710 if (!pjsua_acc_is_valid(id)) 2711 id = pjsua_var.default_acc; 2712 2713 return id; 2701 2714 } 2702 2715
Note: See TracChangeset
for help on using the changeset viewer.