FS-9680 #resolve [Add proxy-message param to sofia]
This commit is contained in:
parent
aa3283e256
commit
91945cb1de
|
@ -317,6 +317,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *c
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel);
|
SWITCH_DECLARE(switch_status_t) switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel);
|
||||||
|
|
||||||
|
static inline int switch_channel_var_true(switch_channel_t *channel, const char *variable) {
|
||||||
|
return switch_true(switch_channel_get_variable_dup(channel, variable, SWITCH_FALSE, -1));
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Start iterating over the entries in the channel variable list.
|
* \brief Start iterating over the entries in the channel variable list.
|
||||||
* \param channel the channel to iterate the variables for
|
* \param channel the channel to iterate the variables for
|
||||||
|
|
|
@ -295,6 +295,7 @@ typedef enum {
|
||||||
PFLAG_BLIND_AUTH_ENFORCE_RESULT,
|
PFLAG_BLIND_AUTH_ENFORCE_RESULT,
|
||||||
PFLAG_PROXY_HOLD,
|
PFLAG_PROXY_HOLD,
|
||||||
PFLAG_PROXY_INFO,
|
PFLAG_PROXY_INFO,
|
||||||
|
PFLAG_PROXY_MESSAGE,
|
||||||
|
|
||||||
/* No new flags below this line */
|
/* No new flags below this line */
|
||||||
PFLAG_MAX
|
PFLAG_MAX
|
||||||
|
@ -939,7 +940,8 @@ switch_status_t sofia_proxy_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua
|
||||||
sofia_dispatch_event_t *de, tagi_t tags[]);
|
sofia_dispatch_event_t *de, tagi_t tags[]);
|
||||||
void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
|
void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
|
||||||
sofia_dispatch_event_t *de, tagi_t tags[]);
|
sofia_dispatch_event_t *de, tagi_t tags[]);
|
||||||
|
switch_status_t sofia_proxy_sip_i_message(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
|
||||||
|
sofia_dispatch_event_t *de, tagi_t tags[]);
|
||||||
void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, sofia_dispatch_event_t *de, tagi_t tags[]);
|
void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, sofia_dispatch_event_t *de, tagi_t tags[]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1710,7 +1710,25 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||||
sofia_handle_sip_i_state(session, status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
|
sofia_handle_sip_i_state(session, status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
|
||||||
break;
|
break;
|
||||||
case nua_i_message:
|
case nua_i_message:
|
||||||
sofia_presence_handle_sip_i_message(status, phrase, nua, profile, nh, session, sofia_private, sip, de, tags);
|
{
|
||||||
|
int handle_message = 1;
|
||||||
|
int proxy_message = sofia_test_pflag(profile, PFLAG_PROXY_MESSAGE);
|
||||||
|
|
||||||
|
if (!proxy_message && session) {
|
||||||
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
proxy_message = switch_channel_var_true(channel, "sip_proxy_message");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proxy_message) {
|
||||||
|
if (sofia_proxy_sip_i_message(nua, profile, nh, session, sip, de, tags) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
handle_message = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (handle_message) {
|
||||||
|
sofia_presence_handle_sip_i_message(status, phrase, nua, profile, nh, session, sofia_private, sip, de, tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case nua_i_info:
|
case nua_i_info:
|
||||||
{
|
{
|
||||||
|
@ -5663,6 +5681,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||||
} else {
|
} else {
|
||||||
sofia_clear_pflag(profile, PFLAG_PROXY_INFO);
|
sofia_clear_pflag(profile, PFLAG_PROXY_INFO);
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(var, "proxy-message")) {
|
||||||
|
if(switch_true(val)) {
|
||||||
|
sofia_set_pflag(profile, PFLAG_PROXY_MESSAGE);
|
||||||
|
} else {
|
||||||
|
sofia_clear_pflag(profile, PFLAG_PROXY_MESSAGE);
|
||||||
|
}
|
||||||
} else if (!strcasecmp(var, "proxy-notify-events")) {
|
} else if (!strcasecmp(var, "proxy-notify-events")) {
|
||||||
profile->proxy_notify_events = switch_core_strdup(profile->pool, val);
|
profile->proxy_notify_events = switch_core_strdup(profile->pool, val);
|
||||||
} else if (!strcasecmp(var, "proxy-info-content-types")) {
|
} else if (!strcasecmp(var, "proxy-info-content-types")) {
|
||||||
|
@ -9117,6 +9141,45 @@ static switch_status_t create_info_event(sip_t const *sip,
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_status_t sofia_proxy_sip_i_message(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
|
||||||
|
sofia_dispatch_event_t *de, tagi_t tags[])
|
||||||
|
{
|
||||||
|
switch_core_session_t *other_session = NULL;
|
||||||
|
|
||||||
|
if (session && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
if (switch_core_session_compare(session, other_session)) {
|
||||||
|
private_object_t *other_tech_pvt = NULL;
|
||||||
|
const char *ct = NULL;
|
||||||
|
char *pl = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
if (sip && sip->sip_payload && sip->sip_payload->pl_data) {
|
||||||
|
pl = sip->sip_payload->pl_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
other_tech_pvt = (private_object_t *) switch_core_session_get_private(other_session);
|
||||||
|
|
||||||
|
if (sip->sip_content_type->c_type && sip->sip_content_type->c_subtype) {
|
||||||
|
ct = sip->sip_content_type->c_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
nua_message(other_tech_pvt->nh,
|
||||||
|
TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(su_strdup(other_tech_pvt->nh->nh_home, ct))),
|
||||||
|
TAG_IF(!zstr(other_tech_pvt->user_via), SIPTAG_VIA_STR(other_tech_pvt->user_via)),
|
||||||
|
TAG_IF(pl, SIPTAG_PAYLOAD_STR(su_strdup(other_tech_pvt->nh->nh_home, pl))),
|
||||||
|
TAG_END());
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_core_session_rwunlock(other_session);
|
||||||
|
|
||||||
|
nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
switch_status_t sofia_proxy_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
|
switch_status_t sofia_proxy_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
|
||||||
sofia_dispatch_event_t *de, tagi_t tags[])
|
sofia_dispatch_event_t *de, tagi_t tags[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#define closesocket(x) close(x)
|
#define closesocket(x) close(x)
|
||||||
#endif
|
#endif
|
||||||
#include <switch_utils.h>
|
#include <switch.h>
|
||||||
#include "mcast.h"
|
#include "mcast.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue