mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-23 11:36:09 +00:00
add sip_call_id variable to sofia
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4062 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
00d7e70e2d
commit
f11f120a05
@ -306,6 +306,7 @@ struct private_object {
|
|||||||
char *chat_from;
|
char *chat_from;
|
||||||
char *chat_to;
|
char *chat_to;
|
||||||
char *e_dest;
|
char *e_dest;
|
||||||
|
char *call_id;
|
||||||
unsigned long rm_rate;
|
unsigned long rm_rate;
|
||||||
switch_payload_t pt;
|
switch_payload_t pt;
|
||||||
switch_mutex_t *flag_mutex;
|
switch_mutex_t *flag_mutex;
|
||||||
@ -800,6 +801,7 @@ static void tech_set_codecs(private_object_t *tech_pvt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void attach_private(switch_core_session_t *session,
|
static void attach_private(switch_core_session_t *session,
|
||||||
sofia_profile_t *profile,
|
sofia_profile_t *profile,
|
||||||
private_object_t *tech_pvt,
|
private_object_t *tech_pvt,
|
||||||
@ -829,6 +831,7 @@ static void attach_private(switch_core_session_t *session,
|
|||||||
tech_set_codecs(tech_pvt);
|
tech_set_codecs(tech_pvt);
|
||||||
snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
|
snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
|
||||||
switch_channel_set_name(channel, name);
|
switch_channel_set_name(channel, name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void terminate_session(switch_core_session_t **session, switch_call_cause_t cause, int line)
|
static void terminate_session(switch_core_session_t **session, switch_call_cause_t cause, int line)
|
||||||
@ -2632,8 +2635,7 @@ static void sip_i_state(int status,
|
|||||||
|
|
||||||
tech_pvt = switch_core_session_get_private(session);
|
tech_pvt = switch_core_session_get_private(session);
|
||||||
assert(tech_pvt != NULL);
|
assert(tech_pvt != NULL);
|
||||||
|
assert(tech_pvt->nh != NULL);
|
||||||
tech_pvt->nh = nh;
|
|
||||||
|
|
||||||
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
|
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
|
||||||
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
|
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
|
||||||
@ -4223,6 +4225,11 @@ static void sip_i_invite(nua_t *nua,
|
|||||||
switch_channel_set_variable(channel, "sip_contact_host", contact_host);
|
switch_channel_set_variable(channel, "sip_contact_host", contact_host);
|
||||||
switch_channel_set_variable(channel, "sip_contact_port", contact_port);
|
switch_channel_set_variable(channel, "sip_contact_port", contact_port);
|
||||||
|
|
||||||
|
if (!tech_pvt->call_id && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
|
||||||
|
tech_pvt->call_id = switch_core_session_strdup(session, (char *)sip->sip_call_id->i_id);
|
||||||
|
switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
|
||||||
|
}
|
||||||
|
|
||||||
via_host = (char *) sip->sip_via->v_host;
|
via_host = (char *) sip->sip_via->v_host;
|
||||||
if (!(via_port = (char *) sip->sip_via->v_port)) {
|
if (!(via_port = (char *) sip->sip_via->v_port)) {
|
||||||
via_port = "5060";
|
via_port = "5060";
|
||||||
@ -4324,7 +4331,7 @@ static void sip_i_invite(nua_t *nua,
|
|||||||
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
|
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
|
||||||
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
|
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
|
||||||
nua_handle_bind(nh, tech_pvt->sofia_private);
|
nua_handle_bind(nh, tech_pvt->sofia_private);
|
||||||
|
tech_pvt->nh = nh;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sip_i_register(nua_t *nua,
|
static void sip_i_register(nua_t *nua,
|
||||||
@ -4500,7 +4507,10 @@ static void event_callback(nua_event_t event,
|
|||||||
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
|
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
|
||||||
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
|
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
|
||||||
}
|
}
|
||||||
|
if (!tech_pvt->call_id && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
|
||||||
|
tech_pvt->call_id = switch_core_session_strdup(session, (char *)sip->sip_call_id->i_id);
|
||||||
|
switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* too late */
|
/* too late */
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user