55 #define SDP_HANDLER_BUCKETS 11 57 #define MOD_DATA_ON_RESPONSE "on_response" 58 #define MOD_DATA_NAT_HOOK "nat_hook" 61 #define DEFAULT_NUM_SESSION_MEDIA 2 118 return "(null session)";
148 if (!strcmp(iter->
id, handler->
id)) {
149 ast_log(
LOG_WARNING,
"Handler '%s' already registered for stream type '%s'.\n", handler->
id, stream_type);
154 ast_debug(1,
"Registered SDP stream handler '%s' for stream type '%s'\n", handler->
id, stream_type);
160 handler_list =
ao2_alloc(
sizeof(*handler_list) + strlen(stream_type),
NULL);
165 strcpy(handler_list->stream_type, stream_type);
168 if (!
ao2_link(sdp_handlers, handler_list)) {
171 ast_debug(1,
"Registered SDP stream handler '%s' for stream type '%s'\n", handler->
id, stream_type);
184 if (!strcmp(iter->
id, handler->
id)) {
186 ast_debug(1,
"Unregistered SDP stream handler '%s' for stream type '%s'\n", handler->
id, stream_type);
192 ast_debug(3,
"No more handlers exist for stream type '%s'\n", stream_type);
215 size_t sessions,
size_t read_callbacks)
219 media_state =
ast_calloc(1,
sizeof(*media_state));
229 if (
AST_VECTOR_INIT(&media_state->read_callbacks, read_callbacks) < 0) {
249 if (!media_state || !sip_session) {
256 if (!media || !media->
rtp) {
321 for (index = 0; index <
AST_VECTOR_SIZE(&media_state->sessions); ++index) {
335 for (index = 0; index <
AST_VECTOR_SIZE(&media_state->read_callbacks); ++index) {
390 .read_callback = callback,
391 .session = session_media,
419 return session_media;
429 return bundle_group_session_media;
433 return session_media;
480 if (session_media->
srtp) {
501 current_session_media =
AST_VECTOR_GET(&media_state->sessions, position);
502 if (current_session_media && current_session_media->
type == type) {
511 if (session_media->
type == type) {
513 ast_trace(1,
"Reusing existing media session\n");
529 ast_trace(1,
"Can't reuse existing media session because the types are different. %s <> %s\n",
531 session_media =
NULL;
535 if (!session_media) {
538 if (!session_media) {
541 ast_trace(1,
"Creating new media session\n");
601 return (type_streams[type] > 0);
617 for (index = 0; index < sdp->attr_count; ++index) {
618 pjmedia_sdp_attr *attr = sdp->attr[index];
619 char value[pj_strlen(&attr->value) + 1], *mids =
value, *attr_mid;
621 if (pj_strcmp2(&attr->name,
"group") || pj_strncmp2(&attr->value,
"BUNDLE", 6)) {
630 while ((attr_mid =
strsep(&mids,
" "))) {
631 if (!strcmp(attr_mid, mid)) {
648 const pjmedia_sdp_session *sdp,
649 const struct pjmedia_sdp_media *stream)
651 pjmedia_sdp_attr *attr;
664 attr = pjmedia_sdp_media_find_attr2(stream,
"mid",
NULL);
670 if (!session_media->
mid) {
686 const pjmedia_sdp_session *sdp,
687 const struct pjmedia_sdp_media *stream,
697 for (index = 0; index < stream->attr_count; ++index) {
698 pjmedia_sdp_attr *attr = stream->attr[index];
699 char attr_value[pj_strlen(&attr->value) + 1];
700 char *ssrc_attribute_name, *ssrc_attribute_value =
NULL;
701 char *msid, *
tmp = attr_value;
702 static const pj_str_t STR_msid = {
"msid", 4 };
703 static const pj_str_t STR_ssrc = {
"ssrc", 4 };
704 static const pj_str_t STR_label = {
"label", 5 };
706 if (!pj_strcmp(&attr->name, &STR_label)) {
709 }
else if (!pj_strcmp(&attr->name, &STR_msid)) {
714 }
else if (!pj_strcmp(&attr->name, &STR_ssrc)) {
717 if ((ssrc_attribute_name = strchr(attr_value,
' '))) {
719 *ssrc_attribute_name++ =
'\0';
720 ssrc_attribute_value = strchr(ssrc_attribute_name,
':');
721 if (ssrc_attribute_value) {
723 *ssrc_attribute_value++ =
'\0';
726 if (!strcasecmp(ssrc_attribute_name,
"mslabel") && !
ast_strlen_zero(ssrc_attribute_value)) {
785 for (i = 0; i < sdp->media_count; ++i) {
794 pjmedia_sdp_media *remote_stream = sdp->media[i];
809 char *stream_name =
NULL, *stream_name_allocated =
NULL;
810 const char *stream_label =
NULL;
831 stream_name = stream_name_allocated;
860 if (pjmedia_sdp_media_find_attr2(remote_stream,
"sendonly",
NULL)) {
866 }
else if (pjmedia_sdp_media_find_attr2(remote_stream,
"recvonly",
NULL)) {
868 }
else if (pjmedia_sdp_media_find_attr2(remote_stream,
"inactive",
NULL)) {
881 if (!session_media) {
889 SCOPE_EXIT_EXPR(
continue,
"%s: Declining incoming SDP media stream %s'\n",
897 handler = session_media->
handler;
898 ast_trace(-1,
"%s: Negotiating incoming SDP media stream %s using %s SDP handler\n",
906 }
else if (res == 0) {
908 SCOPE_EXIT_EXPR(
continue,
"%s: Declining incoming SDP media stream %s\n",
910 }
else if (res > 0) {
912 ++type_streams[
type];
922 SCOPE_EXIT_EXPR(
continue,
"%s: Media stream %s has no registered handlers\n",
926 if (handler == session_media->
handler) {
929 ast_trace(-1,
"%s: Negotiating incoming SDP media stream %s using %s SDP handler\n",
939 }
else if (res == 0) {
941 ast_trace(-1,
"%s: Declining incoming SDP media stream %s\n",
944 }
else if (res > 0) {
947 ++type_streams[
type];
948 ast_trace(-1,
"%s: Media stream %s handled by %s\n",
961 handled ?
"yes" :
"no");
966 const pjmedia_sdp_session *remote,
int index,
struct ast_stream *asterisk_stream)
969 struct pjmedia_sdp_media *local_stream = local->media[index];
977 ast_copy_pj_str(media, &local->media[index]->desc.media,
sizeof(media));
987 if (pjmedia_sdp_media_find_attr2(local_stream,
"sendonly",
NULL)) {
989 }
else if (pjmedia_sdp_media_find_attr2(local_stream,
"recvonly",
NULL)) {
991 }
else if (pjmedia_sdp_media_find_attr2(local_stream,
"inactive",
NULL)) {
1003 handler = session_media->
handler;
1005 ast_debug(4,
"%s: Applying negotiated SDP media stream '%s' using %s SDP handler\n",
1010 ast_debug(4,
"%s: Applied negotiated SDP media stream '%s' using %s SDP handler\n",
1017 SCOPE_EXIT_RTN_VALUE(-1,
"%s: Failed to apply negotiated SDP media stream '%s' using %s SDP handler\n",
1023 if (!handler_list) {
1028 if (handler == session_media->
handler) {
1031 ast_debug(4,
"%s: Applying negotiated SDP media stream '%s' using %s SDP handler\n",
1041 ast_debug(4,
"%s: Applied negotiated SDP media stream '%s' using %s SDP handler\n",
1053 ast_debug(4,
"%s: Stopping SDP media stream '%s' as it is not currently negotiated\n",
1060 res ?
"not negotiated. Stopped" :
"handled");
1067 unsigned int changed = 0;
1079 active_media_state_clone =
1081 if (!active_media_state_clone) {
1103 ast_log(
LOG_WARNING,
"%s: Local SDP contains %d media streams while we expected it to contain %u\n",
1109 for (i = 0; i < local->media_count; ++i) {
1113 if (!remote->media[i]) {
1124 if (!remote->media[i]->desc.port) {
1146 changed |= session_media->
changed;
1154 for (i = 0; i < local->media_count; ++i) {
1158 if (!remote->media[i]) {
1184 if (pjmedia_sdp_neg_was_answer_remote(session->
inv_session->neg) == PJ_FALSE &&
1217 }
else if (changed == 2) {
1226 #define DATASTORE_BUCKETS 53 1227 #define MEDIA_BUCKETS 7 1247 const char *uid_ptr =
uid;
1258 datastore->info =
info;
1265 if (!datastore->uid) {
1312 const char *
str =
"<unknown>";
1397 SCOPE_ENTER(3,
"%s: sending delayed %s request\n",
1502 if (!timer_running) {
1583 int (*cb)(
void *vsession))
1595 int generate_new_sdp,
1602 on_request, on_sdp_creation, on_response, generate_new_sdp, pending_media_state,
1603 active_media_state);
1623 pjsip_inv_session *inv_session = session->
inv_session;
1624 const pjmedia_sdp_session *previous_sdp =
NULL;
1627 if (inv_session->neg) {
1628 if (pjmedia_sdp_neg_was_answer_remote(inv_session->neg)) {
1629 pjmedia_sdp_neg_get_active_remote(inv_session->neg, &previous_sdp);
1631 pjmedia_sdp_neg_get_active_local(inv_session->neg, &previous_sdp);
1641 pj_pool_t *dlg_pool;
1642 pjsip_fromto_hdr *dlg_info;
1643 pjsip_contact_hdr *dlg_contact;
1644 pjsip_name_addr *dlg_info_name_addr;
1645 pjsip_sip_uri *dlg_info_uri;
1646 pjsip_sip_uri *dlg_contact_uri;
1648 const char *pjsip_from_domain;
1668 dlg_contact = session->
inv_session->dlg->local.contact;
1669 dlg_info_name_addr = (pjsip_name_addr *) dlg_info->uri;
1670 dlg_info_uri = pjsip_uri_get_uri(dlg_info_name_addr);
1671 dlg_contact_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(dlg_contact->uri);
1683 dlg_info_name_addr->display.ptr =
NULL;
1684 dlg_info_name_addr->display.slen = 0;
1698 ast_debug(3,
"%s: From header domain reset by channel variable SIPFROMDOMAIN (%s)\n",
1700 pj_strdup2(dlg_pool, &dlg_info_uri->host, pjsip_from_domain);
1713 pj_strdup2(dlg_pool, &dlg_info_name_addr->display,
"Anonymous");
1716 pj_strdup2(dlg_pool, &dlg_info_uri->user,
"anonymous");
1720 pj_strdup2(dlg_pool, &dlg_contact_uri->user,
"anonymous");
1724 pj_strdup2(dlg_pool, &dlg_info_uri->host,
"anonymous.invalid");
1734 #define STREAM_REMOVED(_stream) (ast_stream_get_state(_stream) == AST_STREAM_STATE_REMOVED) 1735 #define STATE_REMOVED(_stream_state) (_stream_state == AST_STREAM_STATE_REMOVED) 1736 #define STATE_NONE(_stream_state) (_stream_state == AST_STREAM_STATE_END) 1737 #define GET_STREAM_SAFE(_topology, _i) (_i < ast_stream_topology_get_count(_topology) ? ast_stream_topology_get_stream(_topology, _i) : NULL) 1738 #define GET_STREAM_STATE_SAFE(_stream) (_stream ? ast_stream_get_state(_stream) : AST_STREAM_STATE_END) 1739 #define GET_STREAM_NAME_SAFE(_stream) (_stream ? ast_stream_get_name(_stream) : "") 1757 SCOPE_ENTER(3,
"%s: Topology: %s\n", session_name,
1760 if (session_count != stream_count) {
1762 session_count, stream_count);
1765 for (i = 0; i < stream_count; i++) {
1768 const char *stream_name =
NULL;
1777 for (j = 0; j < stream_count; j++) {
1779 if (j == i || !possible_dup) {
1795 if (j == i || !possible_dup) {
1801 i, media->
label, j);
1811 SCOPE_EXIT_EXPR(
goto end,
"%s: media %d has type %s but stream has type %s\n", stream_name,
1836 const char *session_name,
1840 int run_post_validation)
1849 int max_stream_count;
1851 SCOPE_ENTER(2,
"%s: DP: %s DA: %s CA: %s\n", session_name,
1866 if (!new_pending_state) {
1869 new_pending = new_pending_state->topology;
1871 for (i = 0; i < max_stream_count; i++) {
1888 const char *found_da_name __attribute__((unused)) =
"";
1889 const char *found_np_name __attribute__((unused)) =
"";
1890 int found_da_slot __attribute__((unused)) = -1;
1891 int found_np_slot = -1;
1892 int removed_np_slot = -1;
1894 SCOPE_ENTER(3,
"%s: slot: %d DP: %s DA: %s CA: %s\n", session_name, i,
1924 SCOPE_EXIT_EXPR(
continue,
"%s: No DP stream so use CA stream as is\n", session_name);
1932 ast_trace(-1,
"%s: Same stream in all 3 states\n", session_name);
1933 if (dp_state == da_state && da_state == ca_state) {
1935 SCOPE_EXIT_EXPR(
continue,
"%s: All in the same state so nothing to do\n", session_name);
1937 if (da_state != ca_state) {
1942 SCOPE_EXIT_EXPR(
continue,
"%s: Ignoring request to change state from %s to %s\n",
1945 if (dp_state != da_state) {
1948 SCOPE_EXIT_EXPR(
continue,
"%s: Changed NP stream state from %s to %s\n",
1973 ast_trace(-1,
"%s: Checking if DP is already in NP somewhere\n", session_name);
1978 ast_trace(-1,
"%s: Checking %s against %s\n", session_name, dp_name, possible_existing_name);
1979 if (found_np_slot == -1 &&
ast_strings_equal(dp_name, possible_existing_name)) {
1980 ast_trace(-1,
"%s: Pending stream %s slot %d is in NP slot %d\n", session_name,
1983 found_np_stream = possible_existing;
1987 if (
STREAM_REMOVED(possible_existing) && removed_np_slot == -1) {
1988 removed_np_slot = j;
1990 if (removed_np_slot >= 0 && found_np_slot >= 0) {
1997 found_np_stream = np_stream;
1998 found_np_state = np_state;
1999 found_np_name = np_name;
2010 ast_trace(-1,
"%s: Checking if DP is already in DA somewhere\n", session_name);
2015 ast_trace(-1,
"%s: Checking %s against %s\n", session_name, dp_name, possible_existing_name);
2017 ast_trace(-1,
"%s: Pending stream %s slot %d is already in delayed active slot %d\n",
2018 session_name, dp_name, i, j);
2020 found_da_stream = possible_existing;
2029 found_da_stream = da_stream;
2030 found_da_state = da_state;
2031 found_da_name = da_name;
2034 ast_trace(-1,
"%s: Found NP slot: %d Found removed NP slot: %d Found DA slot: %d\n",
2035 session_name, found_np_slot, removed_np_slot, found_da_slot);
2042 if (!found_da_stream) {
2049 ast_trace(-1,
"%s: There was no corresponding DA stream so the request was to add a stream\n", session_name);
2051 if (found_np_stream) {
2056 SCOPE_EXIT_EXPR(
continue,
"%s: New stream requested but it's already in CA\n", session_name);
2061 ast_trace(-1,
"%s: There was no corresponding NP stream\n", session_name);
2070 "%s: Attempting to remove stream %d:%s but it doesn't exist anywhere.\n", session_name, i, dp_name);
2077 ast_trace(-1,
"%s: Checking for open slot\n", session_name);
2078 if (removed_np_slot >= 0) {
2096 session_name, removed_np_slot);
2108 session_name, new_slot);
2116 ast_trace(-1,
"%s: There was a corresponding DA stream so the request was to change/remove a stream\n", session_name);
2117 if (dp_state == found_da_state) {
2119 if (!found_np_stream) {
2127 SCOPE_EXIT_EXPR(
continue,
"%s: Stream doesn't exist in CA so nothing to do\n", session_name);
2128 }
else if (dp_state == found_np_state) {
2129 SCOPE_EXIT_EXPR(
continue,
"%s: States are the same all around so nothing to do\n", session_name);
2131 SCOPE_EXIT_EXPR(
continue,
"%s: Something changed the CA state so we're going to leave it as is\n", session_name);
2136 if (!found_np_stream) {
2137 SCOPE_EXIT_EXPR(
continue,
"%s: Stream doesn't exist in CA so nothing to do\n", session_name);
2138 }
else if (da_state == found_np_state) {
2140 SCOPE_EXIT_EXPR(
continue,
"%s: Changed NP stream state from %s to %s\n",
2143 SCOPE_EXIT_EXPR(
continue,
"%s: Something changed the CA state so we're going to leave it as is\n",
2149 SCOPE_EXIT(
"%s: Done with slot %d\n", session_name, i);
2152 ast_trace(-1,
"%s: Resetting default media states\n", session_name);
2155 new_pending_state->default_session[i] =
NULL;
2161 new_pending_state->default_session[i] = media;
2167 if (run_post_validation) {
2168 ast_trace(-1,
"%s: Running post-validation\n", session_name);
2178 returned_media_state = new_pending_state;
2179 new_pending_state =
NULL;
2193 pjsip_inv_session *inv_session = session->
inv_session;
2194 pjmedia_sdp_session *new_sdp =
NULL;
2195 pjsip_tx_data *tdata;
2198 generate_new_sdp ?
"yes" :
"no", queued ?
"yes" :
"no",
2202 if (pending_media_state && (!pending_media_state->
topology || !generate_new_sdp)) {
2207 pending_media_state->
topology ==
NULL ?
"pending topology is null " :
"",
2208 !generate_new_sdp ?
"generate_new_sdp is false" :
"");
2211 if (inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
2220 if (inv_session->dlg->state != PJSIP_DIALOG_STATE_ESTABLISHED) {
2221 res =
delay_request(session, on_request_creation, on_sdp_creation, on_response,
2226 SCOPE_EXIT_RTN_VALUE(res,
"%s: Delay sending reinvite because dialog has not been established\n",
2231 if (inv_session->invite_tsx) {
2233 res =
delay_request(session, on_request_creation, on_sdp_creation,
2238 }
else if (inv_session->state != PJSIP_INV_STATE_CONFIRMED) {
2249 if (generate_new_sdp) {
2251 if (inv_session->neg
2252 && pjmedia_sdp_neg_get_state(inv_session->neg)
2253 != PJMEDIA_SDP_NEG_STATE_DONE) {
2254 res =
delay_request(session, on_request_creation, on_sdp_creation,
2255 on_response, generate_new_sdp,
2259 SCOPE_EXIT_RTN_VALUE(res,
"%s: Delay session refresh with new SDP because SDP negotiation is not yet done\n",
2264 if (pending_media_state) {
2276 res =
delay_request(session, on_request_creation, on_sdp_creation,
2277 on_response, generate_new_sdp,
2289 if (active_media_state && active_media_state->
topology &&
2304 if (new_pending_state) {
2307 pending_media_state = new_pending_state;
2355 if (!existing_stream) {
2381 if (!existing_stream) {
2450 SCOPE_EXIT(
"%s: Appended empty stream in position %d to make counts match\n",
2483 if (on_sdp_creation) {
2484 if (on_sdp_creation(session, new_sdp)) {
2493 if (pjsip_inv_reinvite(inv_session,
NULL, new_sdp, &tdata)) {
2494 if (generate_new_sdp) {
2500 }
else if (pjsip_inv_update(inv_session,
NULL, new_sdp, &tdata)) {
2501 if (generate_new_sdp) {
2507 if (on_request_creation) {
2508 if (on_request_creation(session, tdata)) {
2509 if (generate_new_sdp) {
2532 on_response, method, generate_new_sdp, media_state,
NULL, 0);
2538 pjsip_inv_session *inv_session = session->
inv_session;
2539 pjmedia_sdp_session *new_answer =
NULL;
2540 const pjmedia_sdp_session *previous_offer =
NULL;
2544 if (!inv_session->neg || (pjmedia_sdp_neg_get_state(inv_session->neg) != PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER &&
2545 pjmedia_sdp_neg_get_state(inv_session->neg) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO)) {
2546 ast_log(
LOG_WARNING,
"Requested to regenerate local SDP answer for channel '%s' but negotiation in state '%s'\n",
2551 pjmedia_sdp_neg_get_neg_remote(inv_session->neg, &previous_offer);
2552 if (pjmedia_sdp_neg_get_state(inv_session->neg) == PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) {
2554 pjmedia_sdp_neg_negotiate(inv_session->pool, inv_session->neg, 0);
2555 pjmedia_sdp_neg_set_remote_offer(inv_session->pool, inv_session->neg, previous_offer);
2565 if (on_sdp_creation) {
2566 if (on_sdp_creation(session, new_answer)) {
2571 pjsip_inv_set_sdp_answer(inv_session, new_answer);
2588 .name = {
"Session Module", 14},
2589 .priority = PJSIP_MOD_PRIORITY_APPLICATION,
2611 for (i = 0; i < sdp->media_count; ++i) {
2621 pjmedia_sdp_media *remote_stream = sdp->media[i];
2645 if (existing_stream) {
2654 if (!session_media) {
2660 if (pjmedia_sdp_media_find_attr2(remote_stream,
"sendonly",
NULL)) {
2666 }
else if (pjmedia_sdp_media_find_attr2(remote_stream,
"recvonly",
NULL)) {
2668 }
else if (pjmedia_sdp_media_find_attr2(remote_stream,
"inactive",
NULL)) {
2678 handler = session_media->
handler;
2698 if (!handler_list) {
2703 if (handler == session_media->
handler) {
2737 pjsip_rdata_sdp_info *sdp_info;
2740 if (rdata->msg_info.msg->line.req.method.id != PJSIP_INVITE_METHOD ||
2741 !(dlg = pjsip_ua_find_dialog(&rdata->msg_info.cid->id, &rdata->msg_info.to->tag, &rdata->msg_info.from->tag, PJ_FALSE)) ||
2753 pj_str_t key, deferred_key;
2754 pjsip_tx_data *tdata;
2757 pjsip_tsx_create_key(rdata->tp_info.pool, &key, PJSIP_ROLE_UAS, &rdata->msg_info.cseq->method, rdata);
2758 pjsip_tsx_create_key(rdata->tp_info.pool, &deferred_key, PJSIP_ROLE_UAS, &session->
deferred_reinvite->msg_info.cseq->method,
2762 if (!pj_strcmp(&key, &deferred_key)) {
2767 if (pjsip_dlg_create_response(dlg, rdata, 491,
NULL, &tdata) == PJ_SUCCESS) {
2769 pjsip_tx_data_dec_ref(tdata);
2776 if (!(sdp_info = pjsip_rdata_get_sdp_info(rdata)) ||
2777 (sdp_info->sdp_err != PJ_SUCCESS)) {
2781 if (!sdp_info->sdp) {
2786 if (deferred == -1) {
2789 }
else if (!deferred) {
2813 .name = {
"Session Re-Invite Module", 24 },
2814 .priority = PJSIP_MOD_PRIORITY_UA_PROXY_LAYER - 1,
2821 pjsip_inv_session *inv_session = session->
inv_session;
2828 if (inv_session->state == PJSIP_INV_STATE_DISCONNECTED &&
2829 tdata->msg->line.req.method.id != PJSIP_BYE_METHOD) {
2849 pjmedia_sdp_session *offer;
2853 pjsip_inv_terminate(session->
inv_session, 500, PJ_FALSE);
2857 pjsip_inv_set_local_sdp(session->
inv_session, offer);
2858 pjmedia_sdp_neg_set_prefer_remote_codec_order(session->
inv_session->neg, PJ_FALSE);
2859 #ifdef PJMEDIA_SDP_NEG_ANSWER_MULTIPLE_CODECS 2861 pjmedia_sdp_neg_set_answer_multiple_codecs(session->
inv_session->neg, PJ_TRUE);
2871 if (pjsip_inv_invite(session->
inv_session, tdata) != PJ_SUCCESS) {
2892 const char *uid2 = flags &
OBJ_KEY ? arg : datastore2->
uid;
2905 #ifdef TEST_FRAMEWORK 2907 const char *endpoint_name = session->
endpoint ?
2950 struct pjsip_dialog *dlg = session->
inv_session->dlg;
2956 #ifdef HAVE_PJSIP_INV_SESSION_REF 2959 pjsip_dlg_dec_session(dlg, &session_module);
2995 int dsp_features = 0;
3035 if (!session->
dsp) {
3078 #ifdef HAVE_PJSIP_INV_SESSION_REF 3079 if (pjsip_inv_add_ref(inv_session) != PJ_SUCCESS) {
3085 pjsip_dlg_inc_session(inv_session->dlg, &session_module);
3086 inv_session->mod_data[session_module.id] =
ao2_bump(session);
3233 pjsip_transaction *tsx;
3235 pjsip_inv_session *inv;
3236 pjsip_tx_data *tdata;
3239 if (rdata->msg_info.msg->line.status.code != 401
3240 && rdata->msg_info.msg->line.status.code != 407) {
3245 tsx = pjsip_rdata_get_tsx(rdata);
3246 dlg = pjsip_rdata_get_dlg(rdata);
3251 if (tsx->method.id != PJSIP_INVITE_METHOD) {
3256 inv = pjsip_dlg_get_inv_session(dlg);
3257 session = inv->mod_data[session_module.id];
3259 if (PJSIP_INV_STATE_CONFIRMED <= inv->
state) {
3276 tsx->last_tx, &tdata)) {
3284 pjsip_inv_uac_restart(inv, PJ_FALSE);
3291 .name = {
"Outbound INVITE Auth", 20},
3292 .priority = PJSIP_MOD_PRIORITY_DIALOG_USAGE,
3311 status = pjsip_dlg_add_usage(dlg, &outbound_invite_auth_module,
NULL);
3314 return status != PJ_SUCCESS ? -1 : 0;
3321 const char *uri =
NULL;
3324 pjsip_timer_setting
timer;
3326 struct pjsip_inv_session *inv_session;
3333 if (location || !contact) {
3334 location =
S_OR(location, endpoint->
aors);
3337 &found_aor, &found_contact);
3341 uri = found_contact->uri;
3349 ast_log(
LOG_ERROR,
"Endpoint '%s': No URI available. Is endpoint registered?\n",
3359 pjsip_dlg_terminate(dlg);
3363 if (pjsip_inv_create_uac(dlg,
NULL, endpoint->
extensions.
flags, &inv_session) != PJ_SUCCESS) {
3364 pjsip_dlg_terminate(dlg);
3367 #if defined(HAVE_PJSIP_REPLACE_MEDIA_STREAM) || defined(PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE) 3368 inv_session->sdp_neg_flags = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE;
3371 pjsip_timer_setting_default(&timer);
3374 pjsip_timer_init_session(inv_session, &timer);
3379 pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
3410 pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
3427 pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
3433 if (pjsip_dlg_add_usage(dlg, &session_module,
NULL) != PJ_SUCCESS) {
3434 pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
3454 pjsip_tx_data *packet =
NULL;
3477 case PJSIP_INV_STATE_NULL:
3487 pjsip_inv_terminate(session->
inv_session, response, PJ_TRUE);
3495 pjsip_inv_terminate(session->
inv_session, response, PJ_TRUE);
3498 case PJSIP_INV_STATE_CONFIRMED:
3500 ast_debug(3,
"%s: Delay sending BYE because of outstanding transaction...\n",
3510 status = pjsip_inv_end_session(session->
inv_session, response,
NULL, &packet);
3511 if (status == PJ_SUCCESS && packet) {
3519 if (packet->msg->type == PJSIP_RESPONSE_MSG) {
3556 pj_time_val delay = { .sec = 60, };
3632 pjsip_inv_session *
inv_session = pjsip_dlg_get_inv_session(dlg);
3636 !(session = inv_session->mod_data[session_module.id])) {
3668 pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
3669 pjsip_sip_uri *sip_ruri;
3673 if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {
3677 sip_ruri = pjsip_uri_get_uri(ruri);
3688 ast_log(
LOG_ERROR,
"%s: Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n",
3696 if (!strcmp(session->
exten, pickupexten) ||
3711 !strncmp(session->
exten, pickupexten, strlen(session->
exten)) ||
3743 int answer_code,
int terminate_code, pj_bool_t notify)
3745 pjsip_tx_data *tdata =
NULL;
3748 if (inv_session->state != PJSIP_INV_STATE_DISCONNECTED) {
3749 if (pjsip_inv_initial_answer(
3750 inv_session, rdata, answer_code,
NULL,
NULL, &tdata) != PJ_SUCCESS) {
3752 pjsip_inv_terminate(inv_session, terminate_code ? terminate_code : answer_code, notify);
3755 pjsip_inv_send_msg(inv_session, tdata);
3759 if (answer_code >= 300) {
3764 pjsip_dlg_dec_lock(inv_session->dlg);
3791 pjsip_tx_data *tdata;
3793 pjsip_inv_session *inv_session;
3795 pj_status_t dlg_status = PJ_EUNKNOWN;
3800 pjsip_tx_data_dec_ref(tdata);
3810 if (dlg_status != PJ_EEXISTS) {
3821 if (pjsip_inv_create_uas(dlg, rdata,
NULL, options, &inv_session) != PJ_SUCCESS) {
3828 pjsip_dlg_dec_lock(dlg);
3829 pjsip_dlg_terminate(dlg);
3833 #if defined(HAVE_PJSIP_REPLACE_MEDIA_STREAM) || defined(PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE) 3834 inv_session->sdp_neg_flags = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE;
3836 if (pjsip_dlg_add_usage(dlg, &session_module,
NULL) != PJ_SUCCESS) {
3840 pjsip_dlg_dec_session(inv_session->dlg, &session_module);
3857 pjsip_media_type app_sdp;
3858 pjsip_media_type_init2(&app_sdp,
"application",
"sdp");
3860 if (!pjsip_media_type_cmp(content_type, &app_sdp, 0)) {
3869 pjsip_hdr *hdr = part->hdr.next;
3870 static const pj_str_t str_handling_required = {
"handling=required", 16};
3872 while (hdr != &part->hdr) {
3873 if (hdr->type == PJSIP_H_OTHER) {
3874 pjsip_generic_string_hdr *generic_hdr = (pjsip_generic_string_hdr*)hdr;
3876 if (!pj_stricmp2(&hdr->name,
"Content-Disposition") &&
3877 pj_stristr(&generic_hdr->hvalue, &str_handling_required) &&
3893 pjsip_msg_body *body = rdata->msg_info.msg->body;
3894 pjsip_ctype_hdr *ctype_hdr = rdata->msg_info.ctype;
3896 if (body && ctype_hdr &&
3897 !pj_stricmp2(&ctype_hdr->media.type,
"multipart") &&
3898 (!pj_stricmp2(&ctype_hdr->media.subtype,
"mixed") ||
3899 !pj_stricmp2(&ctype_hdr->media.subtype,
"alternative"))) {
3900 pjsip_multipart_part *part = pjsip_multipart_get_first_part(body);
3901 while (part !=
NULL) {
3905 part = pjsip_multipart_get_next_part(body, part);
3913 pjsip_tx_data *tdata =
NULL;
3914 pjsip_timer_setting
timer;
3915 pjsip_rdata_sdp_info *sdp_info;
3916 pjmedia_sdp_session *local =
NULL;
3938 ast_trace(-1,
"%s: Call (%s:%s) to extension '%s' - unsupported uri\n",
3940 invite->
rdata->tp_info.transport->type_name,
3941 pj_sockaddr_print(&invite->
rdata->pkt_info.src_addr, buffer,
sizeof(buffer), 3),
3950 ast_trace(-1,
"%s: Call (%s:%s) to extension '%s' - partial match\n",
3952 invite->
rdata->tp_info.transport->type_name,
3953 pj_sockaddr_print(&invite->
rdata->pkt_info.src_addr, buffer,
sizeof(buffer), 3),
3964 ast_trace_log(-1,
LOG_NOTICE,
"%s: Call (%s:%s) to extension '%s' rejected because extension not found in context '%s'.\n",
3966 invite->
rdata->tp_info.transport->type_name,
3967 pj_sockaddr_print(&invite->
rdata->pkt_info.src_addr, buffer,
sizeof(buffer), 3),
3988 pjsip_timer_setting_default(&timer);
3998 ast_trace(-1,
"%s: Call (%s:%s) to extension '%s' sending 100 Trying\n",
4000 invite->
rdata->tp_info.transport->type_name,
4001 pj_sockaddr_print(&invite->
rdata->pkt_info.src_addr, buffer,
sizeof(buffer), 3),
4009 sdp_info = pjsip_rdata_get_sdp_info(invite->
rdata);
4010 if (sdp_info && (sdp_info->sdp_err == PJ_SUCCESS) && sdp_info->sdp) {
4037 pjmedia_sdp_neg_set_prefer_remote_codec_order(invite->
session->
inv_session->neg, PJ_FALSE);
4038 #ifdef PJMEDIA_SDP_NEG_ANSWER_MULTIPLE_CODECS 4040 pjmedia_sdp_neg_set_answer_multiple_codecs(invite->
session->
inv_session->neg, PJ_TRUE);
4058 int res =
TRACE_ATLEAST(1) ? pjsip_uri_print(PJSIP_URI_IN_REQ_URI, rdata->msg_info.msg->line.req.uri, req_uri, 256) : 0;
4059 SCOPE_ENTER(1,
"Request: %s\n", res ? req_uri :
"");
4097 pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
4123 pjsip_dlg_dec_lock(inv_session->dlg);
4137 pj_cstr(&method, supplement_method);
4139 return pj_stristr(&method, message_method) ? PJ_TRUE : PJ_FALSE;
4145 struct pjsip_method *
method = &rdata->msg_info.msg->line.req.method;
4166 pjsip_dialog *dlg = pjsip_tsx_get_dlg(tsx);
4167 pjsip_inv_session *inv_session = (dlg ? pjsip_dlg_get_inv_session(dlg) :
NULL);
4168 struct ast_sip_session *session = (inv_session ? inv_session->mod_data[session_module.id] :
NULL);
4170 pjsip_tsx_state_str(tsx->state), inv_session ? pjsip_inv_state_name(inv_session->state) :
"unknown");
4173 ast_trace(2,
"Topology: Pending: %s Active: %s\n",
4188 struct pjsip_status_line status = rdata->msg_info.msg->line.status;
4189 pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
4190 pjsip_inv_session *inv_session = dlg ? pjsip_dlg_get_inv_session(dlg) :
NULL;
4191 struct ast_sip_session *session = (inv_session ? inv_session->mod_data[session_module.id] :
NULL);
4193 (
int)rdata->msg_info.cseq->method.name.slen, rdata->msg_info.cseq->method.name.ptr, status.code);
4217 pj_status_t handled = PJ_FALSE;
4218 struct pjsip_request_line req = rdata->msg_info.msg->line.req;
4219 pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
4220 pjsip_inv_session *inv_session = (dlg ? pjsip_dlg_get_inv_session(dlg) :
NULL);
4221 struct ast_sip_session *session = (inv_session ? inv_session->mod_data[session_module.id] :
NULL);
4223 int res =
TRACE_ATLEAST(1) ? pjsip_uri_print(PJSIP_URI_IN_REQ_URI, rdata->msg_info.msg->line.req.uri, req_uri, 256) : 0;
4225 (
int) pj_strlen(&req.method.name), pj_strbuf(&req.method.name), res ? req_uri :
"");
4227 switch (req.method.id) {
4228 case PJSIP_INVITE_METHOD:
4238 handled = dlg && (inv_session = pjsip_dlg_get_inv_session(dlg)) &&
4244 (
int) pj_strlen(&req.method.name), pj_strbuf(&req.method.name), req_uri,
4245 handled == PJ_TRUE ?
"yes" :
"no");
4252 ast_debug(3,
"%s: re-INVITE collision timer expired.\n",
4276 int use_pending = 0;
4304 if (!pending_media_state) {
4311 if (!active_media_state) {
4318 active_media_state, 1)) {
4330 if (inv->role == PJSIP_ROLE_UAC) {
4349 int id = session_module.id;
4358 function, pjsip_event_str(e->type));
4360 ast_log(
LOG_DEBUG,
"Transaction %p does not belong to an inv_session?\n", tsx);
4362 pjsip_tsx_state_str(tsx->state));
4366 session = inv->mod_data[session_module.id];
4375 if (inv->invite_tsx) {
4382 ast_log(
LOG_DEBUG,
"The %s %.*s transaction involved in this state change is %p\n",
4383 pjsip_role_name(tsx->role),
4384 (
int) pj_strlen(&tsx->method.name), pj_strbuf(&tsx->method.name),
4387 pjsip_tsx_state_str(tsx->state));
4389 pjsip_event_str(e->body.tsx_state.type));
4391 ast_log(
LOG_DEBUG,
"There is no transaction involved in this state change\n");
4393 ast_log(
LOG_DEBUG,
"The current inv state is %s\n", pjsip_inv_state_name(inv->state));
4396 #define print_debug_details(inv, tsx, e) __print_debug_details(__PRETTY_FUNCTION__, (inv), (tsx), (e)) 4401 struct pjsip_request_line req = rdata->msg_info.msg->line.req;
4453 struct pjsip_status_line status = rdata->msg_info.msg->line.status;
4455 status.code, (
int) pj_strlen(&status.reason), pj_strbuf(&status.reason));
4472 if (rdata->msg_info.msg->type == PJSIP_REQUEST_MSG) {
4484 struct pjsip_request_line req = tdata->msg->line.req;
4486 (
int) pj_strlen(&req.method.name), pj_strbuf(&req.method.name));
4501 struct pjsip_status_line status = tdata->msg->line.status;
4502 pjsip_cseq_hdr *cseq = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ,
NULL);
4504 (
int) pj_strlen(&cseq->method.name),
4505 pj_strbuf(&cseq->method.name), status.code, (
int) pj_strlen(&status.reason),
4506 pj_strbuf(&status.reason));
4563 pjsip_transaction *tsx = e->body.tsx_state.tsx;
4565 if (tsx->status_code != 503 && tsx->status_code != 408) {
4573 pjsip_inv_uac_restart(inv, PJ_FALSE);
4578 pjsip_tx_data_add_ref(tsx->last_tx);
4588 "request" :
"response");
4592 msg = rdata->msg_info.msg;
4593 if (msg->type == PJSIP_REQUEST_MSG
4594 && msg->line.req.method.id == PJSIP_ACK_METHOD
4595 && pjmedia_sdp_neg_get_state(inv->neg) != PJMEDIA_SDP_NEG_STATE_DONE) {
4596 pjsip_tx_data *tdata;
4605 "%s: Ending session due to incomplete SDP negotiation. %s\n",
4607 pjsip_rx_data_get_info(rdata));
4608 if (pjsip_inv_end_session(inv, 400,
NULL, &tdata) == PJ_SUCCESS
4617 pjsip_event_id_e
type;
4620 pjsip_event_str(e->type), pjsip_inv_state_name(inv->state));
4630 type = PJSIP_EVENT_UNKNOWN;
4633 session = inv->mod_data[session_module.id];
4639 case PJSIP_EVENT_TX_MSG:
4641 case PJSIP_EVENT_RX_MSG:
4644 case PJSIP_EVENT_TSX_STATE:
4646 pjsip_event_str(e->body.tsx_state.type));
4648 switch(e->body.tsx_state.type) {
4649 case PJSIP_EVENT_TX_MSG:
4651 case PJSIP_EVENT_RX_MSG:
4656 case PJSIP_EVENT_TRANSPORT_ERROR:
4657 case PJSIP_EVENT_TIMER:
4665 case PJSIP_EVENT_USER:
4666 case PJSIP_EVENT_UNKNOWN:
4667 case PJSIP_EVENT_TSX_STATE:
4672 case PJSIP_EVENT_TRANSPORT_ERROR:
4673 case PJSIP_EVENT_TIMER:
4674 case PJSIP_EVENT_UNKNOWN:
4675 case PJSIP_EVENT_USER:
4680 if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
4705 if (inv->state != PJSIP_INV_STATE_DISCONNECTED) {
4713 pjsip_dlg_inc_lock(inv->dlg);
4714 session = inv->mod_data[
id];
4715 inv->mod_data[
id] =
NULL;
4716 pjsip_dlg_dec_lock(inv->dlg);
4734 int id = session_module.id;
4735 pjsip_tx_data *tdata;
4738 pjsip_tsx_state_str(tsx->state), pjsip_inv_state_name(inv->state));
4744 session = inv->mod_data[
id];
4762 switch (e->body.tsx_state.type) {
4763 case PJSIP_EVENT_TX_MSG:
4769 tsx->mod_data[
id] = e->body.tsx_state.src.tdata->mod_data[
id];
4771 case PJSIP_EVENT_RX_MSG:
4778 if ((e->body.tsx_state.src.rdata->msg_info.msg->type != PJSIP_REQUEST_MSG) ||
4779 (tsx->method.id != PJSIP_BYE_METHOD)) {
4783 if (tsx->method.id == PJSIP_INVITE_METHOD) {
4784 if (tsx->role == PJSIP_ROLE_UAC) {
4785 if (tsx->state == PJSIP_TSX_STATE_COMPLETED) {
4787 if (tsx->status_code == PJSIP_SC_REQUEST_PENDING) {
4791 if (inv->state == PJSIP_INV_STATE_CONFIRMED) {
4792 ast_debug(1,
"%s: reINVITE received final response code %d\n",
4795 if ((tsx->status_code == 401 || tsx->status_code == 407)
4799 e->body.tsx_state.src.rdata, tsx->last_tx, &tdata)) {
4808 if (tsx->status_code == 481 || tsx->status_code == 408) {
4809 if (pjsip_inv_end_session(inv, 500,
NULL, &tdata) == PJ_SUCCESS
4815 }
else if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
4816 if (!inv->cancelling
4817 && inv->role == PJSIP_ROLE_UAC
4818 && inv->state == PJSIP_INV_STATE_CONFIRMED
4819 && pjmedia_sdp_neg_was_answer_remote(inv->neg)
4820 && pjmedia_sdp_neg_get_state(inv->neg) == PJMEDIA_SDP_NEG_STATE_DONE
4830 ast_debug(1,
"Endpoint '%s(%s)': Ending session due to 200 OK with incomplete SDP negotiation. %s\n",
4833 pjsip_rx_data_get_info(e->body.tsx_state.src.rdata));
4838 if (inv->cancelling && tsx->status_code == PJSIP_SC_OK) {
4839 int sdp_negotiation_done =
4840 pjmedia_sdp_neg_get_state(inv->neg) == PJMEDIA_SDP_NEG_STATE_DONE;
4864 pjsip_rx_data_get_info(e->body.tsx_state.src.rdata),
4865 sdp_negotiation_done ?
"complete" :
"incomplete");
4866 if (!sdp_negotiation_done) {
4867 ast_debug(1,
"%s: Incomplete SDP negotiation cancelled session. %s\n",
4869 pjsip_rx_data_get_info(e->body.tsx_state.src.rdata));
4870 }
else if (pjsip_inv_end_session(inv, 500,
NULL, &tdata) == PJ_SUCCESS
4872 ast_debug(1,
"%s: Ending session due to RFC5407 race condition. %s\n",
4874 pjsip_rx_data_get_info(e->body.tsx_state.src.rdata));
4882 if (tsx->role == PJSIP_ROLE_UAC) {
4883 if (tsx->state == PJSIP_TSX_STATE_COMPLETED) {
4885 ast_debug(1,
"%s: %.*s received final response code %d\n",
4887 (
int) pj_strlen(&tsx->method.name), pj_strbuf(&tsx->method.name),
4889 if ((tsx->status_code == 401 || tsx->status_code == 407)
4893 e->body.tsx_state.src.rdata, tsx->last_tx, &tdata)) {
4897 (
int) pj_strlen(&tsx->method.name), pj_strbuf(&tsx->method.name));
4903 cb(session, e->body.tsx_state.src.rdata);
4906 case PJSIP_EVENT_TRANSPORT_ERROR:
4907 case PJSIP_EVENT_TIMER:
4916 case PJSIP_EVENT_USER:
4917 case PJSIP_EVENT_UNKNOWN:
4918 case PJSIP_EVENT_TSX_STATE:
4928 if (tsx->method.id == PJSIP_INVITE_METHOD) {
4929 if (tsx->state == PJSIP_TSX_STATE_PROCEEDING) {
4930 ast_debug(3,
"%s: INVITE delay check. tsx-state:%s\n",
4932 pjsip_tsx_state_str(tsx->state));
4934 }
else if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
4940 ast_debug(3,
"%s: INVITE delay check. tsx-state:%s\n",
4942 pjsip_tsx_state_str(tsx->state));
4945 }
else if (tsx->role == PJSIP_ROLE_UAC
4946 && tsx->state == PJSIP_TSX_STATE_COMPLETED
4947 && !pj_strcmp2(&tsx->method.name,
"UPDATE")) {
4948 ast_debug(3,
"%s: UPDATE delay check. tsx-state:%s\n",
4950 pjsip_tsx_state_str(tsx->state));
4959 const struct pjmedia_sdp_session *remote,
4978 if (!handler_list) {
4984 if (handler == session_media->
handler) {
5006 char *mids[PJMEDIA_MAX_SDP_MEDIA];
5014 pjmedia_sdp_attr *attr;
5020 attr = pjmedia_sdp_attr_create(pool,
"msid-semantic", pj_cstr(&stmp,
"WMS *"));
5021 pjmedia_sdp_attr_add(&answer->attr_count, answer->attr, attr);
5028 memset(bundle_groups, 0,
sizeof(bundle_groups));
5039 bundle_group = &bundle_groups[session_media->
bundle_group];
5042 if (!bundle_group->
mids[0]) {
5043 bundle_group->
mids[0] = session_media->
mid;
5053 for (mid_id = 1; mid_id < PJMEDIA_MAX_SDP_MEDIA; ++mid_id) {
5054 if (!bundle_group->
mids[mid_id]) {
5055 bundle_group->
mids[mid_id] = session_media->
mid;
5058 }
else if (!strcmp(bundle_group->
mids[mid_id], session_media->
mid)) {
5065 for (index = 0; index < PJMEDIA_MAX_SDP_MEDIA; ++index) {
5066 bundle_group = &bundle_groups[index];
5073 pjmedia_sdp_attr_add(&answer->attr_count, answer->attr, attr);
5083 static const pj_str_t STR_IN = {
"IN", 2 };
5084 static const pj_str_t STR_IP4 = {
"IP4", 3 };
5085 static const pj_str_t STR_IP6 = {
"IP6", 3 };
5086 pjmedia_sdp_session *local;
5091 if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
5096 if (!inv->pool_prov || !(local = PJ_POOL_ZALLOC_T(inv->pool_prov, pjmedia_sdp_session))) {
5101 local->origin.version = local->origin.id = (pj_uint32_t)(
ast_random());
5103 local->origin.version = offer->origin.version + 1;
5104 local->origin.id = offer->origin.id;
5131 unsigned int streams = local->media_count;
5140 if (!session_media) {
5153 if (streams != local->media_count) {
5154 pjmedia_sdp_media *media = local->media[streams];
5156 pjmedia_sdp_attr *attr;
5160 attr = pjmedia_sdp_attr_create(inv->pool_prov,
"mid", pj_cstr(&stmp, session_media->
mid));
5161 pjmedia_sdp_attr_add(&media->attr_count, media->attr, attr);
5171 if (local->media_count == PJMEDIA_MAX_SDP_MEDIA) {
5172 SCOPE_EXIT_EXPR(
break,
"%s: Stream %s exceeded max pjmedia count of %d\n",
5174 PJMEDIA_MAX_SDP_MEDIA);
5191 for (stream = 0; stream < local->media_count; stream++) {
5193 if (!local->media[stream]->conn) {
5198 if (!pj_strcmp(&local->conn->net_type, &local->media[stream]->conn->net_type) &&
5199 !pj_strcmp(&local->conn->addr_type, &local->media[stream]->conn->addr_type) &&
5200 !pj_strcmp(&local->conn->addr, &local->media[stream]->conn->addr)) {
5201 local->media[stream]->conn =
NULL;
5207 local->conn = local->media[stream]->conn;
5208 local->media[stream]->conn =
NULL;
5217 local->conn = pj_pool_zalloc(inv->pool_prov,
sizeof(
struct pjmedia_sdp_conn));
5218 local->conn->net_type = STR_IN;
5228 pj_strassign(&local->origin.net_type, &local->conn->net_type);
5229 pj_strassign(&local->origin.addr_type, &local->conn->addr_type);
5230 pj_strassign(&local->origin.addr, &local->conn->addr);
5239 pjmedia_sdp_session *
answer;
5246 session = inv->mod_data[session_module.id];
5253 pjsip_inv_set_sdp_answer(inv, answer);
5262 const pjmedia_sdp_session *previous_sdp =
NULL;
5263 pjmedia_sdp_session *offer;
5267 if (pjmedia_sdp_neg_was_answer_remote(inv->neg)) {
5268 pjmedia_sdp_neg_get_active_remote(inv->neg, &previous_sdp);
5270 pjmedia_sdp_neg_get_active_local(inv->neg, &previous_sdp);
5301 for (i = 0; i < offer->media_count; ++i) {
5302 pjmedia_sdp_media *m = offer->media[i];
5303 pjmedia_sdp_attr *recvonly;
5304 pjmedia_sdp_attr *inactive;
5305 pjmedia_sdp_attr *sendonly;
5307 recvonly = pjmedia_sdp_attr_find2(m->attr_count, m->attr,
"recvonly",
NULL);
5308 inactive = pjmedia_sdp_attr_find2(m->attr_count, m->attr,
"inactive",
NULL);
5309 sendonly = pjmedia_sdp_attr_find2(m->attr_count, m->attr,
"sendonly",
NULL);
5310 if (recvonly || inactive || sendonly) {
5311 pjmedia_sdp_attr *to_remove = recvonly ?: inactive ?: sendonly;
5312 pjmedia_sdp_attr *sendrecv;
5314 pjmedia_sdp_attr_remove(&m->attr_count, m->attr, to_remove);
5316 sendrecv = pjmedia_sdp_attr_create(session->
inv_session->pool,
"sendrecv",
NULL);
5317 pjmedia_sdp_media_add_attr(m, sendrecv);
5327 const pjmedia_sdp_session *local, *remote;
5334 session = inv->mod_data[session_module.id];
5335 if (!session || !session->
channel) {
5357 if (inv->following_fork) {
5365 #ifdef HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS 5366 else if (inv->updated_sdp_answer) {
5380 if ((status != PJ_SUCCESS) || (pjmedia_sdp_neg_get_active_local(inv->neg, &local) != PJ_SUCCESS) ||
5381 (pjmedia_sdp_neg_get_active_remote(inv->neg, &remote) != PJ_SUCCESS)) {
5398 const pjsip_sip_uri *uri;
5401 return PJSIP_REDIRECT_STOP;
5404 session = inv->mod_data[session_module.id];
5405 if (!session || !session->
channel) {
5406 return PJSIP_REDIRECT_STOP;
5410 return PJSIP_REDIRECT_ACCEPT;
5413 if (!PJSIP_URI_SCHEME_IS_SIP(target) && !PJSIP_URI_SCHEME_IS_SIPS(target)) {
5414 return PJSIP_REDIRECT_STOP;
5419 uri = pjsip_uri_get_uri(target);
5432 ast_channel_call_forward_set(session->
channel, exten);
5434 char target_uri[PJSIP_MAX_URL_SIZE];
5438 pjsip_uri_print(PJSIP_URI_IN_REQ_URI, uri, target_uri,
sizeof(target_uri));
5440 ast_channel_call_forward_set(session->
channel, forward);
5443 return PJSIP_REDIRECT_STOP;
5462 struct pjmedia_sdp_session *sdp;
5463 pjsip_dialog *dlg = pjsip_tdata_get_dlg(tdata);
5468 if (!transport_state || hook || !tdata->msg->body ||
5474 sdp = tdata->msg->body->data;
5477 char host[NI_MAXHOST];
5491 pj_strassign(&sdp->origin.addr, &sdp->conn->addr);
5495 for (stream = 0; stream < sdp->media_count; ++stream) {
5502 ast_copy_pj_str(media, &sdp->media[stream]->desc.media,
sizeof(media));
5505 if (!handler_list) {
5521 #ifdef TEST_FRAMEWORK 5555 if (!session_media) {
5564 strcpy(session_media->
label, name);
5577 return session_media;
5582 if (left == right) {
5593 return memcmp(left, right,
sizeof(*left)) == 0;
5597 int assert_on_failure)
5602 if (left == right) {
5606 if (!(left && right)) {
5662 #define FREE_STATE() \ 5664 ast_sip_session_media_state_free(new_pending_state); \ 5665 new_pending_state = NULL; \ 5666 ast_sip_session_media_state_free(delayed_pending_state); \ 5667 delayed_pending_state = NULL; \ 5668 ast_sip_session_media_state_free(delayed_active_state); \ 5669 delayed_active_state = NULL; \ 5670 ast_sip_session_media_state_free(current_active_state); \ 5671 current_active_state = NULL; \ 5672 ast_sip_session_media_state_free(expected_pending_state); \ 5673 expected_pending_state = NULL; \ 5676 #define RESET_STATE(__num) \ 5679 ast_trace(-1, "Test %d\n", testnum); \ 5681 delayed_pending_state = ast_sip_session_media_state_alloc(); \ 5682 delayed_pending_state->topology = ast_stream_topology_alloc(); \ 5683 delayed_active_state = ast_sip_session_media_state_alloc(); \ 5684 delayed_active_state->topology = ast_stream_topology_alloc(); \ 5685 current_active_state = ast_sip_session_media_state_alloc(); \ 5686 current_active_state->topology = ast_stream_topology_alloc(); \ 5687 expected_pending_state = ast_sip_session_media_state_alloc(); \ 5688 expected_pending_state->topology = ast_stream_topology_alloc(); \ 5693 new_pending_state = resolve_refresh_media_states("unittest", delayed_pending_state, delayed_active_state, current_active_state, 1); \ 5694 if (!test_is_media_state_equal(new_pending_state, expected_pending_state, 0)) { \ 5695 res = AST_TEST_FAIL; \ 5697 ast_test_status_update(test, "da: %s\n", ast_str_tmp(256, ast_stream_topology_to_str(delayed_active_state->topology, &STR_TMP))); \ 5698 ast_test_status_update(test, "dp: %s\n", ast_str_tmp(256, ast_stream_topology_to_str(delayed_pending_state->topology, &STR_TMP))); \ 5699 ast_test_status_update(test, "ca: %s\n", ast_str_tmp(256, ast_stream_topology_to_str(current_active_state->topology, &STR_TMP))); \ 5700 ast_test_status_update(test, "ep: %s\n", ast_str_tmp(256, ast_stream_topology_to_str(expected_pending_state->topology, &STR_TMP))); \ 5701 ast_test_status_update(test, "np: %s\n", ast_str_tmp(256, ast_stream_topology_to_str(new_pending_state->topology, &STR_TMP))); \ 5703 ast_test_status_update(test, "Test %d %s\n", testnum, test_failed ? "FAILED" : "passed"); \ 5704 ast_trace(-1, "Test %d %s\n", testnum, test_failed ? "FAILED" : "passed"); \ 5716 int test_failed = 0;
5722 info->name =
"merge_refresh_topologies";
5723 info->category =
"/res/res_pjsip_session/";
5724 info->summary =
"Test merging of delayed request topologies";
5725 info->description =
"Test merging of delayed request topologies";
6076 pjsip_endpoint *endpt;
6088 if (!sdp_handlers) {
6092 pjsip_inv_usage_init(endpt, &inv_callback);
6093 pjsip_100rel_init_module(endpt);
6094 pjsip_timer_init_module(endpt);
6102 #ifdef TEST_FRAMEWORK 6110 #ifdef TEST_FRAMEWORK 6127 .requires =
"res_pjsip",
ast_sip_session_response_priority
Describes when a supplement should be called into on incoming responses.
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
void ast_sip_session_suspend(struct ast_sip_session *session)
Request and wait for the session serializer to be suspended.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
#define SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level,...)
Information needed to identify an endpoint in a call.
#define AST_SOCKADDR_BUFLEN
static int set_mid_and_bundle_group(struct ast_sip_session *session, struct ast_sip_session_media *session_media, const pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream)
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
struct ast_sip_endpoint * endpoint
struct ast_sip_session * ast_sip_session_alloc(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, pjsip_inv_session *inv_session, pjsip_rx_data *rdata)
Allocate a new SIP session.
static pjsip_module session_reinvite_module
#define AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(str)
Truncate the URI user field options string if enabled.
const char * ast_stream_to_str(const struct ast_stream *stream, struct ast_str **buf)
Get a string representing the stream for debugging/display purposes.
enum ast_sip_dtmf_mode dtmf
ast_sip_session_sdp_creation_cb on_sdp_creation
char * str
Subscriber phone number (Malloced)
static int load_module(void)
void ast_taskprocessor_build_name(char *buf, unsigned int size, const char *format,...)
Build a taskprocessor name with a sequence number on the end.
#define SDP_HANDLER_BUCKETS
static int unload_module(void)
void ast_sip_add_usereqphone(const struct ast_sip_endpoint *endpoint, pj_pool_t *pool, pjsip_uri *uri)
Add 'user=phone' parameter to URI if enabled and user is a phone number.
struct ast_frame *(* ast_sip_session_media_read_cb)(struct ast_sip_session *session, struct ast_sip_session_media *session_media)
Asterisk locking-related definitions:
unsigned int sess_expires
Asterisk main include file. File version handling, generic pbx functions.
static pj_bool_t session_on_rx_response(pjsip_rx_data *rdata)
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
static void reschedule_reinvite(struct ast_sip_session *session, ast_sip_session_response_cb on_response)
const ast_string_field fromuser
int(* ast_sip_session_response_cb)(struct ast_sip_session *session, pjsip_rx_data *rdata)
void(* stream_destroy)(struct ast_sip_session_media *session_media)
Destroy a session_media created by this handler.
void ast_sip_session_defer_termination_cancel(struct ast_sip_session *session)
Cancel a pending deferred termination.
static int is_media_state_valid(const char *session_name, struct ast_sip_session_media_state *state)
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
struct ast_sip_session * ast_sip_dialog_get_session(pjsip_dialog *dlg)
Retrieves a session from a dialog.
int ast_sip_session_defer_termination(struct ast_sip_session *session)
Defer local termination of a session until remote side terminates, or an amount of time passes...
int(* ast_sip_session_request_creation_cb)(struct ast_sip_session *session, pjsip_tx_data *tdata)
#define print_debug_details(inv, tsx, e)
static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_transport *transport)
Hook for modifying outgoing messages with SDP to contain the proper address information.
struct ast_sip_session_media_state * pending_media_state
int(* ast_sip_session_media_write_cb)(struct ast_sip_session *session, struct ast_sip_session_media *session_media, struct ast_frame *frame)
struct ast_sip_session_media_state * pending_media_state
static int session_end_completion(void *vsession)
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
#define STREAM_REMOVED(_stream)
int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
Retrieve statistics about an RTP instance.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
static pjsip_inv_callback inv_callback
void ast_sip_session_send_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
Send a SIP response.
#define AST_VECTOR_REMOVE_CMP_UNORDERED(vec, value, cmp, cleanup)
Remove an element from a vector that matches the given comparison.
static int send_delayed_request(struct ast_sip_session *session, struct ast_sip_session_delayed_request *delay)
static int handle_incoming_sdp(struct ast_sip_session *session, const pjmedia_sdp_session *sdp)
#define STATE_NONE(_stream_state)
static const pjsip_method message_method
const ast_string_field transport
void ast_dsp_free(struct ast_dsp *dsp)
#define DSP_FEATURE_DIGIT_DETECT
static pjsip_inv_session * pre_session_setup(pjsip_rx_data *rdata, const struct ast_sip_endpoint *endpoint)
static int is_stream_limitation_reached(enum ast_media_type type, const struct ast_sip_endpoint *endpoint, int *type_streams)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
static void set_from_header(struct ast_sip_session *session)
void ast_sip_dialog_set_serializer(pjsip_dialog *dlg, struct ast_taskprocessor *serializer)
Set a serializer on a SIP dialog so requests and responses are automatically serialized.
unsigned int defer_terminate
#define RESET_STATE(__num)
void(* session_destroy)(struct ast_sip_session *session)
Notification that the session is being destroyed.
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
unsigned int terminate_while_deferred
struct ao2_container * datastores
Convenient Signal Processing routines.
static int handle_negotiated_sdp(struct ast_sip_session *session, const pjmedia_sdp_session *local, const pjmedia_sdp_session *remote)
enum ast_media_type ast_stream_get_type(const struct ast_stream *stream)
Get the media type of a stream.
static int check_content_disposition(pjsip_rx_data *rdata)
static int test_is_media_state_equal(struct ast_sip_session_media_state *left, struct ast_sip_session_media_state *right, int assert_on_failure)
int(* incoming_request)(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
Called on incoming SIP request This method can indicate a failure in processing in its return...
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static int setup_outbound_invite_auth(pjsip_dialog *dlg)
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
void ast_sip_session_media_state_free(struct ast_sip_session_media_state *media_state)
Free a session media state structure.
#define ao2_callback(c, flags, cb_fn, arg)
static int delay_request(struct ast_sip_session *session, ast_sip_session_request_creation_cb on_request, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, int generate_new_sdp, enum delayed_method method, struct ast_sip_session_media_state *pending_media_state, struct ast_sip_session_media_state *active_media_state, int queue_head)
const ast_string_field external_media_address
static int check_sdp_content_type_supported(pjsip_media_type *content_type)
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
unsigned int ended_while_deferred
void(* outgoing_response)(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
Called on an outgoing SIP response This method is always called from a SIP servant thread...
AST_TEST_DEFINE(test_resolve_refresh_media_states)
struct ast_sip_session * session
Session created for the new INVITE.
A handler for SDPs in SIP sessions.
const char * ast_codec_media_type2str(enum ast_media_type type)
Conversion function to take a media type and turn it into a string.
void ast_party_id_copy(struct ast_party_id *dest, const struct ast_party_id *src)
Copy the source party id information to the destination party id.
static pj_pool_t * pool
Global memory pool for configuration and timers.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
void ast_sip_dialog_set_endpoint(pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint)
Set an endpoint on a SIP dialog so in-dialog requests do not undergo endpoint lookup.
struct ast_sip_auth_vector outbound_auths
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
void * pvt
Pointer to channel specific implementation information, must be ao2 object.
Universally unique identifier support.
enum ast_media_type ast_media_type_from_str(const char *media_type_str)
Conversion function to take a media string and convert it to a media type.
Set when the stream has been removed/declined.
ast_sip_session_request_creation_cb on_request_creation
const ast_string_field context
static void delayed_request_free(struct ast_sip_session_delayed_request *delay)
#define AST_TEST_REGISTER(cb)
static int sdp_handler_list_cmp(void *obj, void *arg, int flags)
Structure for a data store type.
#define ast_trace(level,...)
Print a basic trace message.
void(* change_outgoing_sdp_stream_media_address)(struct pjsip_tx_data *tdata, struct pjmedia_sdp_media *stream, struct ast_sip_transport *transport)
Update media stream with external address if applicable.
static int check_content_disposition_in_multipart(pjsip_multipart_part *part)
A structure which contains a channel implementation and session.
struct ast_sip_session * session
Pointer to session.
static int get_mid_bundle_group(const pjmedia_sdp_session *sdp, const char *mid)
struct ast_sip_session_media * ast_sip_session_media_get_transport(struct ast_sip_session *session, struct ast_sip_session_media *session_media)
Retrieve the underlying media session that is acting as transport for a media session.
static const char * delayed_method2str(enum delayed_method method)
#define ast_cond_wait(cond, mutex)
static void session_termination_cb(pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_cond_init(cond, attr)
static struct ast_sip_nat_hook * nat_hook
NAT hook for modifying outgoing messages with SDP.
int ast_stream_get_format_count(const struct ast_stream *stream)
Get the count of the current negotiated formats of a stream.
#define MOD_DATA_ON_RESPONSE
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define ao2_alloc_options(data_size, destructor_fn, options)
static struct ast_sip_session_media * test_media_add(struct ast_sip_session_media_state *media_state, const char *name, enum ast_media_type type, enum ast_stream_state state, int position)
Set when the stream is not sending OR receiving media.
static enum sip_get_destination_result get_destination(struct ast_sip_session *session, pjsip_rx_data *rdata)
Determine where in the dialplan a call should go.
enum delayed_method method
static int test_is_media_session_equal(struct ast_sip_session_media *left, struct ast_sip_session_media *right)
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
void ast_copy_pj_str(char *dest, const pj_str_t *src, size_t size)
Copy a pj_str_t into a standard character buffer.
ast_stream_state
States that a stream may be in.
static int new_invite(struct new_invite *invite)
char exten[AST_MAX_EXTENSION]
struct ast_sip_session_delayed_request * next
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
int ast_stream_topology_append_stream(struct ast_stream_topology *topology, struct ast_stream *stream)
Append a stream to the topology.
#define SCOPE_EXIT_LOG_EXPR(__expr, __log_level,...)
static int handle_negotiated_sdp_session_media(struct ast_sip_session_media *session_media, struct ast_sip_session *session, const pjmedia_sdp_session *local, const pjmedia_sdp_session *remote, int index, struct ast_stream *asterisk_stream)
#define AST_TASKPROCESSOR_MAX_NAME
Suggested maximum taskprocessor name length (less null terminator).
struct pjsip_inv_session * inv_session
struct ast_sip_session * ast_sip_session_create_outgoing(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, const char *location, const char *request_user, struct ast_stream_topology *req_topology)
Create a new outgoing SIP session.
void ast_stream_set_formats(struct ast_stream *stream, struct ast_format_cap *caps)
Set the current negotiated formats of a stream.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
static void handle_session_end(struct ast_sip_session *session)
Socket address structure.
#define ast_cond_signal(cond)
static int invite_terminated(void *vsession)
int ast_stream_topology_set_stream(struct ast_stream_topology *topology, unsigned int position, struct ast_stream *stream)
Set a specific position in a topology.
int ast_sip_session_refresh(struct ast_sip_session *session, ast_sip_session_request_creation_cb on_request_creation, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, enum ast_sip_session_refresh_method method, int generate_new_sdp, struct ast_sip_session_media_state *media_state)
Send a reinvite or UPDATE on a session.
A structure describing a SIP session.
static int stream_destroy(void *obj, void *arg, int flags)
void(* outgoing_request)(struct ast_sip_session *session, struct pjsip_tx_data *tdata)
Called on an outgoing SIP request This method is always called from a SIP servant thread...
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
static void check_delayed_requests(struct ast_sip_session *session, int(*cb)(void *vsession))
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_format_cap * direct_media_cap
#define DATASTORE_BUCKETS
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
enum ast_sip_session_response_priority response_priority
static void session_datastore_destroy(void *obj)
pthread_cond_t ast_cond_t
#define ast_strlen_zero(foo)
int(* negotiate_incoming_sdp_stream)(struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *sdp, int index, struct ast_stream *asterisk_stream)
Set session details based on a stream in an incoming SDP offer or answer.
struct ast_sip_session_media_state * active_media_state
const char * ast_sip_get_host_ip_string(int af)
Retrieve the local host address in string form.
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
int ast_sip_failover_request(pjsip_tx_data *tdata)
Set a request to use the next value in the list of resolved addresses.
static void resend_reinvite(pj_timer_heap_t *timer, pj_timer_entry *entry)
struct ast_sip_endpoint * ast_pjsip_rdata_get_endpoint(pjsip_rx_data *rdata)
Get the looked-up endpoint on an out-of dialog request or response.
struct ast_sip_endpoint_media_configuration media
Asterisk datastore objects.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
void * ao2_object_get_lockaddr(void *obj)
Return the mutex lock address of an object.
static int session_end(void *vsession)
#define ast_trace_log(__level, __log_level,...)
#define ast_str_tmp(init_len, __expr)
#define DEFAULT_NUM_SESSION_MEDIA
sip_get_destination_result
int ast_taskprocessor_suspend(struct ast_taskprocessor *tps)
Indicate the taskprocessor is suspended.
#define ast_debug(level,...)
Log a DEBUG message.
int ast_sorcery_create(const struct ast_sorcery *sorcery, void *object)
Create and potentially persist an object using an available wizard.
pjsip_rx_data * deferred_reinvite
Structure for SIP nat hook information.
static void session_destructor(void *obj)
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
Structure for SIP transport information.
struct ast_sip_session_sdp_handler * next
struct ast_sip_session_media_state * active_media_state
static void session_inv_on_media_update(pjsip_inv_session *inv, pj_status_t status)
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.
void(* outgoing_external_message)(struct pjsip_tx_data *tdata, struct ast_sip_transport *transport)
static int sip_session_refresh(struct ast_sip_session *session, ast_sip_session_request_creation_cb on_request_creation, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, enum ast_sip_session_refresh_method method, int generate_new_sdp, struct ast_sip_session_media_state *pending_media_state, struct ast_sip_session_media_state *active_media_state, int queued)
#define ast_sip_mod_data_set(pool, mod_data, id, key, val)
Utilizing a mod_data array for a given id, set the value associated with the given key...
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
static int handle_incoming(struct ast_sip_session *session, pjsip_rx_data *rdata, enum ast_sip_session_response_priority response_priority)
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
static pj_bool_t outbound_invite_auth(pjsip_rx_data *rdata)
SRTP and SDP Security descriptions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
pjsip_rx_data * rdata
INVITE request itself.
static struct ast_mansession session
Access Control of various sorts.
static void session_inv_on_rx_offer(pjsip_inv_session *inv, const pjmedia_sdp_session *offer)
#define AST_MAX_EXTENSION
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
static struct ast_sip_session_media_state * internal_sip_session_media_state_alloc(size_t sessions, size_t read_callbacks)
#define ao2_ref(o, delta)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
#define DSP_FEATURE_FAX_DETECT
pj_timer_entry rescheduled_reinvite
int ast_sip_session_register_sdp_handler(struct ast_sip_session_sdp_handler *handler, const char *stream_type)
Register an SDP handler.
long int ast_random(void)
const struct ast_datastore_info * info
void(* destroy)(void *data)
int ast_sip_session_is_pending_stream_default(const struct ast_sip_session *session, const struct ast_stream *stream)
Determines if a provided pending stream will be the default stream or not.
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
#define ast_strdupa(s)
duplicate a string in memory from the stack
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
static int check_request_status(pjsip_inv_session *inv, pjsip_event *e)
struct ast_channel * channel
static void handle_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
void(* incoming_response)(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
Called on an incoming SIP response This method is always called from a SIP servant thread...
int ast_sip_create_request_with_auth(const struct ast_sip_auth_vector *auths, pjsip_rx_data *challenge, pjsip_tx_data *tdata, pjsip_tx_data **new_request)
Create a response to an authentication challenge.
struct ast_sip_channel_pvt * ast_sip_channel_pvt_alloc(void *pvt, struct ast_sip_session *session)
Allocate a new SIP channel pvt structure.
static void session_media_set_handler(struct ast_sip_session_media *session_media, struct ast_sip_session_sdp_handler *handler)
Set an SDP stream handler for a corresponding session media.
#define SCOPE_EXIT(...)
Scope Exit.
static void handle_incoming_before_media(pjsip_inv_session *inv, struct ast_sip_session *session, pjsip_rx_data *rdata)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
static pjsip_module session_module
const struct ast_format_cap * ast_stream_get_formats(const struct ast_stream *stream)
Get the current negotiated formats of a stream.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
int ast_taskprocessor_unsuspend(struct ast_taskprocessor *tps)
Indicate the taskprocessor is unsuspended.
An entity with which Asterisk communicates.
static pj_bool_t has_supplement(const struct ast_sip_session *session, const pjsip_rx_data *rdata)
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
static int answer(void *data)
static void session_inv_on_create_offer(pjsip_inv_session *inv, pjmedia_sdp_session **p_offer)
unsigned int ast_sip_get_use_callerid_contact(void)
Retrieve the global setting 'use_callerid_contact'.
static void handle_session_destroy(struct ast_sip_session *session)
int ast_sip_register_service(pjsip_module *module)
Register a SIP service in Asterisk.
#define SCOPE_EXIT_EXPR(__expr,...)
Core PBX routines and definitions.
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
unsigned int trust_outbound
static void remove_stream_from_bundle(struct ast_sip_session_media *session_media, struct ast_stream *stream)
struct ast_taskprocessor * serializer
#define ast_sip_mod_data_get(mod_data, id, key)
Using the dictionary stored in mod_data array at a given id, retrieve the value associated with the g...
void ast_stream_set_group(struct ast_stream *stream, int group)
Set the stream group for a stream.
void ast_sip_location_retrieve_contact_and_aor_from_list_filtered(const char *aor_list, unsigned int flags, struct ast_sip_aor **aor, struct ast_sip_contact **contact)
Retrieve the first bound contact AND the AOR chosen from a list of AORs and filter based on flags...
int ast_sip_is_content_type(pjsip_media_type *content_type, char *type, char *subtype)
Checks if the given content type matches type/subtype.
#define ast_test_suite_event_notify(s, f,...)
static int add_sdp_streams(struct ast_sip_session_media *session_media, struct ast_sip_session *session, pjmedia_sdp_session *answer, const struct pjmedia_sdp_session *remote, struct ast_stream *stream)
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
static int datastore_hash(const void *obj, int flags)
struct ast_sip_endpoint_id_configuration id
void ast_sip_session_resume_reinvite(struct ast_sip_session *session)
Resumes processing of a deferred incoming re-invite.
static int invite_proceeding(void *vsession)
void ast_sip_session_remove_supplements(struct ast_sip_session *session)
Remove supplements from a SIP session.
static pjmedia_sdp_session * generate_session_refresh_sdp(struct ast_sip_session *session)
int ast_shutdown_final(void)
static void sip_session_defer_termination_stop_timer(struct ast_sip_session *session)
#define SCOPE_EXIT_LOG_RTN(__log_level,...)
static void session_inv_on_new_session(pjsip_inv_session *inv, pjsip_event *e)
int ast_sorcery_delete(const struct ast_sorcery *sorcery, void *object)
Delete an object.
Set when the stream is sending and receiving media.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
struct ast_stream_topology * ast_channel_set_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
Set the topology of streams on a channel.
static void session_media_dtor(void *obj)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int ast_stream_topology_equal(const struct ast_stream_topology *left, const struct ast_stream_topology *right)
Compare two stream topologies to see if they are equal.
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
struct ast_stream_topology * ast_stream_topology_alloc(void)
Create a stream topology.
static struct ast_stream * test_stream_alloc(const char *name, enum ast_media_type type, enum ast_stream_state state)
int ast_sip_push_task(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Pushes a task to SIP servants.
void ast_sip_session_remove_datastore(struct ast_sip_session *session, const char *name)
Remove a session datastore from the session.
#define AST_TEST_UNREGISTER(cb)
static int datastore_cmp(void *obj, void *arg, int flags)
#define ast_module_shutdown_ref(mod)
Prevent unload of the module before shutdown.
enum ast_sip_dtmf_mode dtmf
struct ast_sip_session_media * ast_sip_session_media_state_add(struct ast_sip_session *session, struct ast_sip_session_media_state *media_state, enum ast_media_type type, int position)
Allocate an ast_session_media and add it to the media state's vector.
#define ao2_callback_data(container, flags, cb_fn, arg, data)
#define ast_sip_transport_is_local(transport_state, addr)
int ast_strings_equal(const char *str1, const char *str2)
Compare strings for equality checking for NULL.
struct ast_taskprocessor * ast_sip_create_serializer(const char *name)
Create a new serializer for SIP tasks.
static int add_bundle_groups(struct ast_sip_session *session, pj_pool_t *pool, pjmedia_sdp_session *answer)
ast_sip_session_refresh_method
#define ast_cond_destroy(cond)
#define ao2_alloc(data_size, destructor_fn)
struct sdp_handler_list::@487 list
struct ast_taskprocessor * ast_sip_get_distributor_serializer(pjsip_rx_data *rdata)
Determine the distributor serializer for the SIP message.
pj_timer_entry scheduled_termination
void * ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, const char *id)
Allocate an object.
#define MAX_RX_CHALLENGES
#define SCOPE_EXIT_RTN(...)
Scope Exit with return.
static void session_inv_on_state_changed(pjsip_inv_session *inv, pjsip_event *e)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
int ast_sip_session_regenerate_answer(struct ast_sip_session *session, ast_sip_session_sdp_creation_cb on_sdp_creation)
Regenerate SDP Answer.
ast_sip_session_sdp_stream_defer
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
unsigned int preferred_codec_only
#define ast_channel_unlock(chan)
int ast_taskprocessor_is_task(struct ast_taskprocessor *tps)
Am I the given taskprocessor's current task.
Set when the stream is sending media only.
struct ast_sip_transport_state * ast_sip_get_transport_state(const char *transport_id)
Retrieve transport state.
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
struct ast_sip_timer_options timer
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_sip_session_media_stats_save(struct ast_sip_session *sip_session, struct ast_sip_session_media_state *media_state)
Save a media stats.
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
pjsip_dialog * ast_sip_create_dialog_uas_locked(const struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, pj_status_t *status)
General purpose method for creating a UAS dialog with an endpoint.
static void session_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e)
void(* session_end)(struct ast_sip_session *session)
Notification that the session has ended.
static struct ast_sip_session_delayed_request * delayed_request_alloc(enum delayed_method method, ast_sip_session_request_creation_cb on_request_creation, ast_sip_session_sdp_creation_cb on_sdp_creation, ast_sip_session_response_cb on_response, int generate_new_sdp, struct ast_sip_session_media_state *pending_media_state, struct ast_sip_session_media_state *active_media_state)
#define GET_STREAM_SAFE(_topology, _i)
void ast_sip_message_apply_transport(const char *transport_name, pjsip_tx_data *tdata)
Apply the configuration for a transport to an outgoing message.
#define STATE_REMOVED(_stream_state)
ast_cond_t cond_suspended
unsigned int moh_passthrough
void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state)
Set the state of a stream.
struct ast_sip_session::@308 supplements
Structure used for sending delayed requests.
char * ast_uuid_generate_str(char *buf, size_t size)
Generate a UUID string.
#define SCOPE_ENTER(level,...)
Non RAII_VAR Scope Trace macros The advantage of these macros is that the EXITs will have the actual ...
static void handle_session_begin(struct ast_sip_session *session)
struct controlling the suspension of the session's serializer.
static void set_remote_mslabel_and_stream_group(struct ast_sip_session *session, struct ast_sip_session_media *session_media, const pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream, struct ast_stream *asterisk_stream)
struct ast_sip_session_media_state * ast_sip_session_media_state_clone(const struct ast_sip_session_media_state *media_state)
Clone a media state.
Module has failed to load, may be in an inconsistent state.
Vector container support.
static pj_bool_t session_on_rx_request(pjsip_rx_data *rdata)
Called when a new SIP request comes into PJSIP.
#define ao2_find(container, arg, flags)
An API for managing task processing threads that can be shared across modules.
#define TRACE_ATLEAST(level)
const char * ast_sip_session_get_name(const struct ast_sip_session *session)
Get the channel or endpoint name associated with the session.
#define GET_STREAM_STATE_SAFE(_stream)
ast_sip_session_response_cb on_response
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
int ast_taskprocessor_is_suspended(struct ast_taskprocessor *tps)
Get the task processor suspend status.
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
void ast_sdp_srtp_destroy(struct ast_sdp_srtp *srtp)
free a ast_sdp_srtp structure
struct ast_sip_session_suspender * suspended
#define MOD_DATA_NAT_HOOK
static int session_end_if_disconnected(int id, pjsip_inv_session *inv)
struct ast_sip_session_supplement * next
static void handle_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata, enum ast_sip_session_response_priority response_priority)
static pj_bool_t session_reinvite_on_rx_request(pjsip_rx_data *rdata)
Support for logging to various files, console and syslog Configuration in file logger.conf.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
void(* session_begin)(struct ast_sip_session *session)
Notification that the session has begun This method will always be called from a SIP servant thread...
struct ast_sip_session::@309 delayed_requests
static int session_termination_task(void *data)
void ast_sip_modify_id_header(pj_pool_t *pool, pjsip_fromto_hdr *id_hdr, const struct ast_party_id *id)
Set name and number information on an identity header.
A supplement to SIP message processing.
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
void ast_sip_session_unregister_sdp_handler(struct ast_sip_session_sdp_handler *handler, const char *stream_type)
Unregister an SDP handler.
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
#define AST_PRES_RESTRICTION
struct ast_frame ast_null_frame
static int remove_handler(void *obj, void *arg, void *data, int flags)
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
Scope Exit with return value.
static int sdp_requires_deferral(struct ast_sip_session *session, const pjmedia_sdp_session *sdp)
Determine whether the SDP provided requires deferral of negotiating or not.
void ast_stream_free(struct ast_stream *stream)
Destroy a media stream representation.
static struct pjmedia_sdp_session * create_local_sdp(pjsip_inv_session *inv, struct ast_sip_session *session, const pjmedia_sdp_session *offer)
unsigned int allow_overlap
static pjsip_redirect_op session_inv_on_redirected(pjsip_inv_session *inv, const pjsip_uri *target, const pjsip_event *e)
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
char * strsep(char **str, const char *delims)
struct ast_stream * ast_stream_alloc(const char *name, enum ast_media_type type)
Create a new media stream representation.
static int invite_collision_timeout(void *vsession)
static void __print_debug_details(const char *function, pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
int ast_channel_hangupcause(const struct ast_channel *chan)
struct ast_stream * ast_stream_clone(const struct ast_stream *stream, const char *name)
Create a deep clone of an existing stream.
#define GET_STREAM_NAME_SAFE(_stream)
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
const char * ast_channel_name(const struct ast_channel *chan)
enum ast_sip_session_call_direction call_direction
static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
void ast_sip_unregister_service(pjsip_module *module)
const char * ast_stream_state2str(enum ast_stream_state state)
Convert the state of a stream into a string.
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
int ast_stream_set_metadata(struct ast_stream *stream, const char *m_key, const char *value)
Set a stream metadata value.
const char * ast_stream_get_metadata(const struct ast_stream *stream, const char *m_key)
Get a stream metadata value.
static void handle_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
static void sip_session_suspender_dtor(void *vdoomed)
#define AST_VECTOR_REPLACE(vec, idx, elem)
Replace an element at a specific position in a vector, growing the vector if needed.
static int media_stats_local_ssrc_cmp(const struct ast_rtp_instance_stats *vec_elem, const struct ast_rtp_instance_stats *srch)
Data structure associated with a single frame of data.
Internal Asterisk hangup causes.
void ast_sip_session_send_request_with_cb(struct ast_sip_session *session, pjsip_tx_data *tdata, ast_sip_session_response_cb on_response)
Send a SIP request and get called back when a response is received.
unsigned int authentication_challenge_count
enum ast_sip_session_sdp_stream_defer(* defer_incoming_sdp_stream)(struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream)
Determine whether a stream requires that the re-invite be deferred. If a stream can not be immediatel...
static int sip_session_suspend_task(void *data)
struct ast_sip_endpoint_extensions extensions
int ast_sip_session_add_supplements(struct ast_sip_session *session)
Add supplements to a SIP session.
void ast_sip_session_media_state_reset(struct ast_sip_session_media_state *media_state)
Reset a media state to a clean state.
pjsip_dialog * ast_sip_create_dialog_uac(const struct ast_sip_endpoint *endpoint, const char *aor_name, const char *request_user)
General purpose method for creating a UAC dialog with an endpoint.
ast_media_type
Types of media.
static void handle_outgoing_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Return only reachable or unknown contacts.
void ast_sip_session_unsuspend(struct ast_sip_session *session)
Request the session serializer be unsuspended.
int ast_sip_session_media_set_write_callback(struct ast_sip_session *session, struct ast_sip_session_media *session_media, ast_sip_session_media_write_cb callback)
Set a write callback for a media session.
void ast_sip_session_send_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
Send a SIP request.
static pj_timer_heap_t * timer_heap
Global timer heap.
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
int ast_sip_session_create_invite(struct ast_sip_session *session, pjsip_tx_data **tdata)
Creates an INVITE request.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
struct ast_sip_session_media_state * ast_sip_session_media_state_alloc(void)
Allocate a session media state structure.
const ast_string_field aors
pjsip_fromto_hdr * saved_from_hdr
const char * ast_stream_get_name(const struct ast_stream *stream)
Get the name of a stream.
int ast_sip_session_media_add_read_callback(struct ast_sip_session *session, struct ast_sip_session_media *session_media, int fd, ast_sip_session_media_read_cb callback)
Set a read callback for a media session with a specific file descriptor.
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define DEBUG_ATLEAST(level)
static int sdp_handler_list_hash(const void *obj, int flags)
static struct ast_timer * timer
#define AST_VECTOR_REMOVE(vec, idx, preserve_ordered)
Remove an element from a vector by index.
struct ast_sip_contact * contact
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
Asterisk module definitions.
static pj_bool_t does_method_match(const pj_str_t *message_method, const char *supplement_method)
int ast_channel_stream_topology_changed_externally(struct ast_channel *chan)
Provide notice from a channel that the topology has changed on it as a result of the remote party ren...
int ast_sip_session_add_datastore(struct ast_sip_session *session, struct ast_datastore *datastore)
Add a datastore to a SIP session.
enum ast_sip_session_redirect redirect_method
void ast_sip_session_end_if_deferred(struct ast_sip_session *session)
End the session if it had been previously deferred.
unsigned char valid
TRUE if the number information is valid/present.
static void sip_channel_destroy(void *obj)
Destructor for SIP channel.
static struct ao2_container * sdp_handlers
Registered SDP stream handlers.
int(* create_outgoing_sdp_stream)(struct ast_sip_session *session, struct ast_sip_session_media *session_media, struct pjmedia_sdp_session *sdp, const struct pjmedia_sdp_session *remote, struct ast_stream *stream)
Create an SDP media stream and add it to the outgoing SDP offer or answer.
int(* ast_sip_session_sdp_creation_cb)(struct ast_sip_session *session, pjmedia_sdp_session *sdp)
Set when the stream is receiving media only.
int(* apply_negotiated_sdp_stream)(struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *local, const struct pjmedia_sdp_session *remote, int index, struct ast_stream *asterisk_stream)
Apply a negotiated SDP media stream.
int ast_stream_topology_del_stream(struct ast_stream_topology *topology, unsigned int position)
Delete a specified stream from the given topology.
enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream)
Get the current state of a stream.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
unsigned int position
The position of the stream in the topology.
static void handle_new_invite_request(pjsip_rx_data *rdata)
static pjsip_module outbound_invite_auth_module
void(* stream_stop)(struct ast_sip_session_media *session_media)
Stop a session_media created by this handler but do not destroy resources.
struct ast_stream * ast_sip_session_create_joint_call_stream(const struct ast_sip_session *session, struct ast_stream *remote)
Create a new stream of joint capabilities.
static struct ast_sip_session_media_state * resolve_refresh_media_states(const char *session_name, struct ast_sip_session_media_state *delayed_pending_state, struct ast_sip_session_media_state *delayed_active_state, struct ast_sip_session_media_state *current_active_state, int run_post_validation)
static int new_invite_initial_answer(pjsip_inv_session *inv_session, pjsip_rx_data *rdata, int answer_code, int terminate_code, pj_bool_t notify)
static char * ast_sockaddr_stringify_host(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only, suitable for a URL (with brack...
static int update_completed(void *vsession)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
unsigned int moh_passthrough
const ast_string_field fromdomain
const ast_string_field pickupexten
Configuration relating to call pickup.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
struct ast_party_number number
Subscriber phone number.
void ast_sip_session_terminate(struct ast_sip_session *session, int response)
Terminate a session and, if possible, send the provided response code.
#define ao2_link(container, obj)