[asterisk-commits] oej: branch oej/sip-callpickup-1.2 r73888 - /team/oej/sip-callpickup-1.2/chan...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Jul 8 08:32:15 CDT 2007
Author: oej
Date: Sun Jul 8 08:32:14 2007
New Revision: 73888
URL: http://svn.digium.com/view/asterisk?view=rev&rev=73888
Log:
Ok, start using the caller ID data we got from the core
Modified:
team/oej/sip-callpickup-1.2/channels/chan_sip.c
Modified: team/oej/sip-callpickup-1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sip-callpickup-1.2/channels/chan_sip.c?view=diff&rev=73888&r1=73887&r2=73888
==============================================================================
--- team/oej/sip-callpickup-1.2/channels/chan_sip.c (original)
+++ team/oej/sip-callpickup-1.2/channels/chan_sip.c Sun Jul 8 08:32:14 2007
@@ -930,7 +930,7 @@
static int determine_firstline_parts(struct sip_request *req);
static void sip_dump_history(struct sip_pvt *dialog); /* Dump history to LOG_DEBUG at end of dialog, before destroying data */
static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
-static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout, const char *channel);
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout, const char *channel, const struct ast_callerid *cid);
static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize);
/*! \brief Definition of this channel for PBX channel registration */
@@ -1324,7 +1324,7 @@
/* If this is a subscription, tell the phone that we got a timeout */
if (p->subscribed) {
- transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1, 1, NULL); /* Send first notification */
+ transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1, 1, NULL, NULL); /* Send first notification */
p->subscribed = NONE;
append_history(p, "Subscribestatus", "timeout");
return 10000; /* Reschedule this destruction so that we know that it's gone */
@@ -5177,7 +5177,7 @@
}
/*! \brief transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/
-static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout, const char *channel)
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout, const char *channel, const struct ast_callerid *cid)
{
char tmp[4000], from[256], to[256];
char *t = tmp, *c, *a, *mfrom, *mto;
@@ -5334,12 +5334,19 @@
ast_build_string(&t, &maxbytes, "<dialog id=\"%s\">\n", p->exten);
ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
if ((state & AST_EXTENSION_RINGING) && global_notifyringing) {
+ char *cid_name = "Call Pickup", *cid_num = ast_pickup_ext();
+ if (cid) {
+ if (!ast_strlen_zero(cid->cid_name))
+ cid_name = cid->cid_name;
+ if (!ast_strlen_zero(cid->cid_num))
+ cid_name = cid->cid_num;
+ }
/* We use the pickup extension for remote-uri. The replaces header on the INVITE
will override this, but for phones that doesn't send replaces, the pickup
extension is the next best thing
*/
- ast_build_string(&t, &maxbytes, "<remote><identity display=\"Call Pickup\"></identity>\n<target uri=\"%s\">\n"
- "</target>\n</remote>\n", ast_pickup_ext());
+ ast_build_string(&t, &maxbytes, "<remote><identity display=\"%s\"></identity>\n<target uri=\"%s\">\n"
+ "</target>\n</remote>\n", cid_name, cid_num);
ast_build_string(&t, &maxbytes, "<local>\n<target uri=\"%s\">\n"
"</target>\n</local>\n", mto);
}
@@ -6597,11 +6604,11 @@
p->laststate = state;
break;
}
- transmit_state_notify(p, state, 1, 1, 0, channel);
+ transmit_state_notify(p, state, 1, 1, 0, channel, cid);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s (channel %s)\n", exten, ast_extension_state2str(state), p->username, channel ? channel : "<none>");
- if (option_debug > 1 && state == AST_STATE_RINGING) {
+ if (option_debug > 1 && state == AST_EXTENSION_RINGING) {
if (cid)
ast_log(LOG_DEBUG, "=== Ringing state. Caller ID name %s, caller ID num %s\n", cid->cid_name, cid->cid_num);
else
@@ -11252,7 +11259,7 @@
struct sip_pvt *p_old;
transmit_response(p, "200 OK", req);
- transmit_state_notify(p, firststate, 1, 1, 0, NULL); /* Send first notification */
+ transmit_state_notify(p, firststate, 1, 1, 0, NULL, NULL); /* Send first notification */
append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
/* remove any old subscription from this peer for the same exten/context,
More information about the asterisk-commits
mailing list