提交 da8d9bc2 authored 作者: Brian West's avatar Brian West

wip

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6802 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 3f581d06
......@@ -2,7 +2,7 @@
<!--the domain or ip (the right hand side of the @ in the addr-->
<domain name="$${domain}">
<params>
<param name="dial-string" value="sofia/${dialed_domain}/${dialed_user}"/>
<param name="dial-string" value="{presence_id=${dialed_user}@${dialed_domain}}sofia/${dialed_domain}/${dialed_user}"/>
</params>
<X-PRE-PROCESS cmd="include" data="default/*.xml"/>
......
......@@ -2125,7 +2125,7 @@ int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du)
}
if (du->du_cr && cr != du->du_cr) {
assert(!nua_client_is_queued(du->du_cr));
if (nua_client_is_queued(du->du_cr))
return -1;
if (nua_client_is_reporting(du->du_cr)) {
......
......@@ -998,9 +998,13 @@ static int show_reg_callback(void *pArg, int argc, char **argv, char **columnNam
"Call-ID \t%s\n"
"User \t%s@%s\n"
"Contact \t%s\n"
"Agent \t%s\n"
"Status \t%s(%s) EXP(%s)\n\n",
switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_str_nil(argv[3]),
switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf);
switch_str_nil(argv[7]),
switch_str_nil(argv[4]),
switch_str_nil(argv[5]),
exp_buf);
return 0;
}
......
......@@ -58,6 +58,17 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
char const *phrase,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
if (status == 481 && sip) {
const char *call_id = sip->sip_call_id->i_id;
char *sql;
switch_core_hash_delete(profile->sub_hash, call_id);
sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id);
switch_assert(sql != NULL);
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
free(sql);
nua_handle_destroy(nh);
}
}
void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
......@@ -318,7 +329,7 @@ void event_handler(switch_event_t *event)
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, NULL);
switch_safe_free(sql);
sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','Regestered', '%q', %ld, '%q')",
sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q')",
call_id, from_user, from_host, contact_str, rpid, expires, user_agent);
if (sql) {
......@@ -398,6 +409,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)),
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence")),
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("dialog")),
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("call-info")),
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence.winfo")),
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("message-summary")),
SIPTAG_SUPPORTED_STR("100rel, precondition, timer"), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
......
......@@ -1233,6 +1233,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *stream;
switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "hold");
if (tech_pvt->max_missed_packets) {
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets * 10);
}
......@@ -1251,6 +1252,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
}
switch_channel_set_flag_partner(tech_pvt->channel, CF_BREAK);
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "unhold");
}
}
......
......@@ -120,6 +120,7 @@ struct switch_channel {
switch_hash_t *private_hash;
switch_call_cause_t hangup_cause;
int vi;
int event_count;
};
......@@ -305,6 +306,7 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
}
if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%s", __FILE__);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", __FILE__);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", id);
......@@ -316,6 +318,8 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status);
}
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", channel->event_count++);
switch_event_fire(&event);
}
......@@ -587,8 +591,11 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s Running State Change %s\n",
channel->name, state_names[channel->state]);
channel->running_state = channel->state;
if (channel->state >= CS_RING) {
switch_channel_presence(channel, "unknown", (char *) state_names[channel->state]);
}
if (channel->state < CS_HANGUP) {
switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_STATE) == SWITCH_STATUS_SUCCESS) {
......@@ -601,6 +608,14 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", channel->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "confirmed");
} else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "early");
} else {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing");
}
}
switch_event_fire(&event);
}
......@@ -799,9 +814,6 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
if (ok) {
if (state > CS_RING) {
switch_channel_presence(channel, "unknown", (char *) state_names[state]);
}
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
channel->name, state_names[last_state], state_names[state]);
switch_mutex_lock(channel->flag_mutex);
......@@ -858,6 +870,15 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered");
} else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "early");
} else {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing");
}
if ((codec = switch_core_session_get_read_codec(channel->session)) && codec->implementation) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论