@@ -947,6 +947,30 @@ PJ_DEF(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
947947 status = PJSIP_EINVALIDREQURI ;
948948 goto on_error ;
949949 }
950+
951+ /* Verify contact URI if provided */
952+ if (msg_data && msg_data -> contact_uri .slen ) {
953+ pj_strdup_with_null (tmp_pool , & dup , & msg_data -> contact_uri );
954+ uri = pjsip_parse_uri (tmp_pool , dup .ptr , dup .slen , 0 );
955+ if (uri == NULL ) {
956+ pjsua_perror (THIS_FILE , "Invalid contact URI" ,
957+ PJSIP_EINVALIDREQURI );
958+ status = PJSIP_EINVALIDREQURI ;
959+ goto on_error ;
960+ }
961+ }
962+
963+ /* Verify local URI if provided */
964+ if (msg_data && msg_data -> local_uri .slen ) {
965+ pj_strdup_with_null (tmp_pool , & dup , & msg_data -> local_uri );
966+ uri = pjsip_parse_uri (tmp_pool , dup .ptr , dup .slen , 0 );
967+ if (uri == NULL ) {
968+ pjsua_perror (THIS_FILE , "Invalid local URI" ,
969+ PJSIP_EINVALIDREQURI );
970+ status = PJSIP_EINVALIDREQURI ;
971+ goto on_error ;
972+ }
973+ }
950974 }
951975
952976 /* Mark call start time. */
@@ -956,9 +980,11 @@ PJ_DEF(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
956980 call -> res_time .sec = 0 ;
957981
958982 /* Create suitable Contact header unless a Contact header has been
959- * set in the account.
983+ * set in the account or message data .
960984 */
961- if (acc -> contact .slen ) {
985+ if (msg_data && msg_data -> contact_uri .slen ) {
986+ contact = msg_data -> contact_uri ;
987+ } else if (acc -> contact .slen ) {
962988 contact = acc -> contact ;
963989 } else {
964990 status = pjsua_acc_create_uac_contact (tmp_pool , & contact ,
0 commit comments