[asterisk-commits] mmichelson: branch group/CCSS r238179 - /team/group/CCSS/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 6 14:24:48 CST 2010
Author: mmichelson
Date: Wed Jan 6 14:24:44 2010
New Revision: 238179
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=238179
Log:
* Set the expiry field for SUBSCRIBE sip_pvts so that the
transmit_invite function can automatically insert the proper
Expires header.
* Send a SUBSCRIBE with Expires: 0 when a call completion transaction
terminates.
* Change logic in __sip_autodestruct so that we don't send excess NOTIFYs
during call-completion failures
Modified:
team/group/CCSS/channels/chan_sip.c
Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=238179&r1=238178&r2=238179
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Wed Jan 6 14:24:44 2010
@@ -3613,7 +3613,11 @@
{
struct sip_monitor_instance *monitor_instance = data;
if (monitor_instance->subscription_pvt) {
+ monitor_instance->subscription_pvt->expiry = 0;
+ transmit_invite(monitor_instance->subscription_pvt, SIP_SUBSCRIBE, FALSE, 0, monitor_instance->subscribe_uri);
+ ast_log(LOG_NOTICE, "BEFORE!\n");
dialog_unref(monitor_instance->subscription_pvt, "Unref monitor instance ref of subscription pvt");
+ ast_log(LOG_NOTICE, "AFTER!\n");
}
if (monitor_instance->suspension_entry) {
ao2_ref(monitor_instance->suspension_entry, -1);
@@ -3701,13 +3705,14 @@
return -1;
}
+ when = service == AST_CC_CCBS ? ast_get_ccbs_available_timer(monitor->interface->config_params) :
+ ast_get_ccnr_available_timer(monitor->interface->config_params);
+
create_addr(monitor_instance->subscription_pvt, monitor_instance->peername, 0, 1);
monitor_instance->subscription_pvt->subscribed = CALL_COMPLETION;
+ monitor_instance->subscription_pvt->expiry = when;
transmit_invite(monitor_instance->subscription_pvt, SIP_SUBSCRIBE, FALSE, 2, monitor_instance->subscribe_uri);
-
- when = service == AST_CC_CCBS ? ast_get_ccbs_available_timer(monitor->interface->config_params) :
- ast_get_ccnr_available_timer(monitor->interface->config_params);
parent_link->child_avail_id = ast_sched_add(sched, when * 1000, ast_cc_available_timer_expire, parent_link);
ao2_ref(monitor_instance, -1);
@@ -5208,8 +5213,10 @@
struct sip_pvt *p = (struct sip_pvt *)data;
/* If this is a subscription, tell the phone that we got a timeout */
- if (p->subscribed) {
+ if (p->subscribed && p->subscribed != MWI_NOTIFICATION && p->subscribed != CALL_COMPLETION) {
+ ast_log(LOG_NOTICE, "DUNG?\n");
transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, TRUE); /* Send last notification */
+ ast_log(LOG_NOTICE, "DUNG 2?\n");
p->subscribed = NONE;
append_history(p, "Subscribestatus", "timeout");
ast_debug(3, "Re-scheduled destruction of SIP subscription %s\n", p->callid ? p->callid : "<unknown>");
@@ -12568,25 +12575,16 @@
}
}
} else if (sipmethod == SIP_SUBSCRIBE) {
+ char buf[SIPBUFSIZE];
if (p->subscribed == MWI_NOTIFICATION) {
- char buf[SIPBUFSIZE];
-
add_header(&req, "Event", "message-summary");
add_header(&req, "Accept", "application/simple-message-summary");
- snprintf(buf, sizeof(buf), "%d", mwi_expiry);
- add_header(&req, "Expires", buf);
} else if (p->subscribed == CALL_COMPLETION) {
- char buf[SIPBUFSIZE];
-
add_header(&req, "Event", "call-completion");
add_header(&req, "Accept", "application/call-completion");
- /* XXX The Expires header should have the CCBS or CCNR available timer
- * instead of the mwi_expiry. For the sake of just making sure basic stuff
- * works, I'll leave this as-is for now and come back later.
- */
- snprintf(buf, sizeof(buf), "%d", mwi_expiry);
- add_header(&req, "Expires", buf);
- }
+ }
+ snprintf(buf, sizeof(buf), "%d", p->expiry);
+ add_header(&req, "Expires", buf);
}
/* This new INVITE is part of an attended transfer. Make sure that the
@@ -12735,6 +12733,8 @@
mwi->call = dialog_unref(mwi->call, "unref dialog after unlink_all");
return 0;
}
+
+ mwi->call->expiry = mwi_expiry;
if (!mwi->dnsmgr && mwi->portno) {
mwi->call->sa.sin_port = htons(mwi->portno);
More information about the asterisk-commits
mailing list