- Timestamp:
- Sep 28, 2010 7:43:18 AM (14 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r3318 r3323 920 920 921 921 case OPT_ID: /* id */ 922 if (pjsua_verify_ sip_url(pj_optarg) != 0) {922 if (pjsua_verify_url(pj_optarg) != 0) { 923 923 PJ_LOG(1,(THIS_FILE, 924 924 "Error: invalid SIP URL '%s' " … … 1038 1038 1039 1039 case OPT_ADD_BUDDY: /* Add to buddy list. */ 1040 if (pjsua_verify_ sip_url(pj_optarg) != 0) {1040 if (pjsua_verify_url(pj_optarg) != 0) { 1041 1041 PJ_LOG(1,(THIS_FILE, 1042 1042 "Error: invalid URL '%s' in " … … 1422 1422 pj_str_t uri_arg; 1423 1423 1424 if (pjsua_verify_ sip_url(argv[pj_optind]) != PJ_SUCCESS) {1424 if (pjsua_verify_url(argv[pj_optind]) != PJ_SUCCESS) { 1425 1425 PJ_LOG(1,(THIS_FILE, "Invalid SIP URI %s", argv[pj_optind])); 1426 1426 return -1; … … 3277 3277 pj_status_t status; 3278 3278 3279 if ((status=pjsua_verify_ sip_url(buf)) != PJ_SUCCESS) {3279 if ((status=pjsua_verify_url(buf)) != PJ_SUCCESS) { 3280 3280 pjsua_perror(THIS_FILE, "Invalid URL", status); 3281 3281 return; … … 3812 3812 break; 3813 3813 3814 if (pjsua_verify_ sip_url(buf) != PJ_SUCCESS) {3815 printf("Invalid SIPURI '%s'\n", buf);3814 if (pjsua_verify_url(buf) != PJ_SUCCESS) { 3815 printf("Invalid URI '%s'\n", buf); 3816 3816 break; 3817 3817 } -
pjproject/trunk/pjsip-apps/src/samples/simple_pjsua.c
r2408 r3323 118 118 /* If argument is specified, it's got to be a valid SIP URL */ 119 119 if (argc > 1) { 120 status = pjsua_verify_ sip_url(argv[1]);120 status = pjsua_verify_url(argv[1]); 121 121 if (status != PJ_SUCCESS) error_exit("Invalid URL in argv", status); 122 122 } -
pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp
r3253 r3323 734 734 } 735 735 736 if (pjsua_verify_ sip_url(SIP_DST_URI) == PJ_SUCCESS) {736 if (pjsua_verify_url(SIP_DST_URI) == PJ_SUCCESS) { 737 737 pj_str_t dst = pj_str(SIP_DST_URI); 738 738 pjsua_call_make_call(g_acc_id, &dst, 0, NULL, -
pjproject/trunk/pjsip-apps/src/symbian_ua_gui/src/symbian_ua.cpp
r3106 r3323 483 483 int symbian_ua_makecall(const char* dest_url) 484 484 { 485 if (pjsua_verify_ sip_url(dest_url) == PJ_SUCCESS) {485 if (pjsua_verify_url(dest_url) == PJ_SUCCESS) { 486 486 pj_str_t dst = pj_str((char*)dest_url); 487 487 pjsua_call_make_call(g_acc_id, &dst, 0, NULL, -
pjproject/trunk/pjsip/include/pjsip/sip_errno.h
r3110 r3323 97 97 */ 98 98 #define PJSIP_ENOTINITIALIZED (PJSIP_ERRNO_START_PJSIP + 4) /* 171004 */ 99 /** 100 * @hideinitializer 101 * Missing route set (for tel: URI) 102 */ 103 #define PJSIP_ENOROUTESET (PJSIP_ERRNO_START_PJSIP + 5) /* 171005 */ 99 104 100 105 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r3322 r3323 1541 1541 /** 1542 1542 * This is a utility function to verify that valid SIP url is given. If the 1543 * URL is valid, PJ_SUCCESS will be returned.1543 * URL is a valid SIP/SIPS scheme, PJ_SUCCESS will be returned. 1544 1544 * 1545 1545 * @param url The URL, as NULL terminated string. 1546 1546 * 1547 1547 * @return PJ_SUCCESS on success, or the appropriate error code. 1548 * 1549 * @see pjsua_verify_url() 1548 1550 */ 1549 1551 PJ_DECL(pj_status_t) pjsua_verify_sip_url(const char *url); 1552 1553 1554 /** 1555 * This is a utility function to verify that valid URI is given. Unlike 1556 * pjsua_verify_sip_url(), this function will return PJ_SUCCESS if tel: URI 1557 * is given. 1558 * 1559 * @param url The URL, as NULL terminated string. 1560 * 1561 * @return PJ_SUCCESS on success, or the appropriate error code. 1562 * 1563 * @see pjsua_verify_sip_url() 1564 */ 1565 PJ_DECL(pj_status_t) pjsua_verify_url(const char *url); 1550 1566 1551 1567 -
pjproject/trunk/pjsip/src/pjsip/sip_errno.c
r3110 r3323 40 40 PJ_BUILD_ERR( PJSIP_ESHUTDOWN, "SIP stack shutting down" ), 41 41 PJ_BUILD_ERR( PJSIP_ENOTINITIALIZED,"SIP object is not initialized." ), 42 PJ_BUILD_ERR( PJSIP_ENOROUTESET, "Missing route set (for tel: URI)" ), 42 43 43 44 /* Messaging errors */ -
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r3260 r3323 836 836 pjsip_transport_get_flag_from_type(dest_info->type); 837 837 } else { 838 /* Should have never reached here; app should have configured route 839 * set when sending to tel: URI 838 840 pj_assert(!"Unsupported URI scheme!"); 841 */ 839 842 PJ_TODO(SUPPORT_REQUEST_ADDR_RESOLUTION_FOR_TEL_URI); 840 return PJSIP_E INVALIDSCHEME;843 return PJSIP_ENOROUTESET; 841 844 } 842 845 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r3322 r3323 120 120 pjsua_acc *acc = &pjsua_var.acc[acc_id]; 121 121 pjsip_name_addr *name_addr; 122 pjsip_sip_uri *sip_ uri, *sip_reg_uri;122 pjsip_sip_uri *sip_reg_uri; 123 123 pj_status_t status; 124 124 unsigned i; … … 137 137 138 138 /* Local URI MUST be a SIP or SIPS: */ 139 140 139 if (!PJSIP_URI_SCHEME_IS_SIP(name_addr) && 141 140 !PJSIP_URI_SCHEME_IS_SIPS(name_addr)) 142 141 { 143 pjsua_perror(THIS_FILE, "Invalid local URI", 144 PJSIP_EINVALIDSCHEME); 145 return PJSIP_EINVALIDSCHEME; 146 } 147 148 149 /* Get the SIP URI object: */ 150 sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(name_addr); 142 acc->display = name_addr->display; 143 acc->user_part = name_addr->display; 144 acc->srv_domain = pj_str(""); 145 acc->srv_port = 0; 146 } else { 147 pjsip_sip_uri *sip_uri; 148 149 /* Get the SIP URI object: */ 150 sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(name_addr); 151 152 /* Save the user and domain part. These will be used when finding an 153 * account for incoming requests. 154 */ 155 acc->display = name_addr->display; 156 acc->user_part = sip_uri->user; 157 acc->srv_domain = sip_uri->host; 158 acc->srv_port = 0; 159 } 151 160 152 161 … … 177 186 sip_reg_uri = NULL; 178 187 } 179 180 /* Save the user and domain part. These will be used when finding an181 * account for incoming requests.182 */183 acc->display = name_addr->display;184 acc->user_part = sip_uri->user;185 acc->srv_domain = sip_uri->host;186 acc->srv_port = 0;187 188 188 189 if (sip_reg_uri) { … … 2161 2162 /* For non-SIP scheme, route set should be configured */ 2162 2163 if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) 2163 return PJSIP_E INVALIDREQURI;2164 return PJSIP_ENOROUTESET; 2164 2165 2165 2166 sip_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(uri); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r3313 r3323 2405 2405 } 2406 2406 2407 2408 /* 2409 * Verify that valid SIP url is given. 2410 */ 2411 PJ_DEF(pj_status_t) pjsua_verify_sip_url(const char *c_url) 2407 /* 2408 * Verify that valid url is given. 2409 */ 2410 PJ_DEF(pj_status_t) pjsua_verify_url(const char *c_url) 2412 2411 { 2413 2412 pjsip_uri *p; … … 2416 2415 int len = (c_url ? pj_ansi_strlen(c_url) : 0); 2417 2416 2418 if (!len) return -1;2417 if (!len) return PJSIP_EINVALIDURI; 2419 2418 2420 2419 pool = pj_pool_create(&pjsua_var.cp.factory, "check%p", 1024, 0, NULL); 2421 if (!pool) return -1; 2420 if (!pool) return PJ_ENOMEM; 2421 2422 url = (char*) pj_pool_alloc(pool, len+1); 2423 pj_ansi_strcpy(url, c_url); 2424 2425 p = pjsip_parse_uri(pool, url, len, 0); 2426 2427 pj_pool_release(pool); 2428 return p ? 0 : PJSIP_EINVALIDURI; 2429 } 2430 2431 /* 2432 * Verify that valid SIP url is given. 2433 */ 2434 PJ_DEF(pj_status_t) pjsua_verify_sip_url(const char *c_url) 2435 { 2436 pjsip_uri *p; 2437 pj_pool_t *pool; 2438 char *url; 2439 int len = (c_url ? pj_ansi_strlen(c_url) : 0); 2440 2441 if (!len) return PJSIP_EINVALIDURI; 2442 2443 pool = pj_pool_create(&pjsua_var.cp.factory, "check%p", 1024, 0, NULL); 2444 if (!pool) return PJ_ENOMEM; 2422 2445 2423 2446 url = (char*) pj_pool_alloc(pool, len+1); … … 2432 2455 2433 2456 pj_pool_release(pool); 2434 return p ? 0 : -1;2457 return p ? 0 : PJSIP_EINVALIDURI; 2435 2458 } 2436 2459
Note: See TracChangeset
for help on using the changeset viewer.