[asterisk-commits] seanbright: branch seanbright/issue13827-1.4 r153828 - in /team/seanbright/is...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 3 07:13:53 CST 2008
Author: seanbright
Date: Mon Nov 3 07:13:52 2008
New Revision: 153828
URL: http://svn.digium.com/view/asterisk?view=rev&rev=153828
Log:
Import current work-in-progress.
Modified:
team/seanbright/issue13827-1.4/channels/chan_sip.c
team/seanbright/issue13827-1.4/configs/sip.conf.sample
Modified: team/seanbright/issue13827-1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/issue13827-1.4/channels/chan_sip.c?view=diff&rev=153828&r1=153827&r2=153828
==============================================================================
--- team/seanbright/issue13827-1.4/channels/chan_sip.c (original)
+++ team/seanbright/issue13827-1.4/channels/chan_sip.c Mon Nov 3 07:13:52 2008
@@ -510,6 +510,7 @@
#define DEFAULT_ALLOW_EXT_DOM TRUE
#define DEFAULT_REALM "asterisk"
#define DEFAULT_NOTIFYRINGING TRUE
+#define DEFAULT_NOTIFYCID FALSE
#define DEFAULT_PEDANTIC FALSE
#define DEFAULT_AUTOCREATEPEER FALSE
#define DEFAULT_QUALIFY FALSE
@@ -542,6 +543,7 @@
static int global_rtautoclear;
static int global_notifyringing; /*!< Send notifications on ringing */
static int global_notifyhold; /*!< Send notifications on hold */
+static int global_notifycid; /*!< Send CID with ringing notifications */
static int global_alwaysauthreject; /*!< Send 401 Unauthorized for all failing requests */
static int srvlookup; /*!< SRV Lookup on or off. Default is on */
static int pedanticsipchecking; /*!< Extra checking ? Default off */
@@ -7427,22 +7429,42 @@
ast_build_string(&t, &maxbytes, "<?xml version=\"1.0\"?>\n");
ast_build_string(&t, &maxbytes, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver++, full ? "full" : "partial", mto);
if ((state & AST_EXTENSION_RINGING) && global_notifyringing) {
+ char *local_display = (char *) p->exten, *local_target = mto;
+
+ /* There are some limitations to how this works. The primary one is that the
+ callee must be dialing the same extension that is being monitored. Simply dialing
+ the hint'd device is not sufficient. */
+ if (global_notifycid) {
+ struct ast_channel *caller = NULL;
+
+ while ((caller = ast_channel_walk_locked(caller))) {
+ if (caller->pbx &&
+ (!strcasecmp(caller->macroexten, p->exten) || !strcasecmp(caller->exten, p->exten)) &&
+ !strcasecmp(caller->context, p->context)) {
+ local_display = ast_strdupa(caller->cid.cid_name);
+ local_target = ast_strdupa(caller->cid.cid_num);
+ ast_channel_unlock(caller);
+ break;
+ }
+ ast_channel_unlock(caller);
+ }
+ }
+
/* We create a fake call-id which the phone will send back in an INVITE
Replaces header which we can grab and do some magic with. */
ast_build_string(&t, &maxbytes,
"<dialog id=\"%s\" call-id=\"pickup-%s\" direction=\"recipient\">\n"
"<remote>\n"
- /* Note that the identity and target elements for the local participant are currently
- (and may forever be) incorrect since we have no reliable way to get at that information
- at the moment. Luckily the phone seems to still live happily without it being correct */
- "<identity>%s</identity>\n"
+ /* See the limitations of this above. Luckily the phone seems to still be
+ happy when these values are not correct. */
+ "<identity display=\"%s\">%s</identity>\n"
"<target uri=\"%s\"/>\n"
"</remote>\n"
"<local>\n"
"<identity>%s</identity>\n"
"<target uri=\"%s\"/>\n"
"</local>\n",
- p->exten, p->callid, mto, mto, mto, mto);
+ p->exten, p->callid, local_display, local_target, local_target, mto, mto);
} else {
ast_build_string(&t, &maxbytes, "<dialog id=\"%s\">\n", p->exten);
}
@@ -10915,6 +10937,9 @@
ast_cli(fd, " Outbound reg. timeout: %d secs\n", global_reg_timeout);
ast_cli(fd, " Outbound reg. attempts: %d\n", global_regattempts_max);
ast_cli(fd, " Notify ringing state: %s\n", global_notifyringing ? "Yes" : "No");
+ if (global_notifyringing) {
+ ast_cli(fd, " Include CID: %s\n", global_notifycid ? "Yes" : "No");
+ }
ast_cli(fd, " Notify hold state: %s\n", global_notifyhold ? "Yes" : "No");
ast_cli(fd, " SIP Transfer mode: %s\n", transfermode2str(global_allowtransfer));
ast_cli(fd, " Max Call Bitrate: %d kbps\r\n", default_maxcallbitrate);
@@ -17551,6 +17576,7 @@
global_regcontext[0] = '\0';
expiry = DEFAULT_EXPIRY;
global_notifyringing = DEFAULT_NOTIFYRINGING;
+ global_notifycid = DEFAULT_NOTIFYCID;
global_limitonpeers = FALSE;
global_directrtpsetup = FALSE; /* Experimental feature, disabled by default */
global_notifyhold = FALSE;
@@ -17693,6 +17719,8 @@
global_notifyringing = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifyhold")) {
global_notifyhold = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "notifycid")) {
+ global_notifycid = ast_true(v->value);
} else if (!strcasecmp(v->name, "alwaysauthreject")) {
global_alwaysauthreject = ast_true(v->value);
} else if (!strcasecmp(v->name, "mohinterpret")
Modified: team/seanbright/issue13827-1.4/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/seanbright/issue13827-1.4/configs/sip.conf.sample?view=diff&rev=153828&r1=153827&r2=153828
==============================================================================
--- team/seanbright/issue13827-1.4/configs/sip.conf.sample (original)
+++ team/seanbright/issue13827-1.4/configs/sip.conf.sample Mon Nov 3 07:13:52 2008
@@ -208,6 +208,16 @@
;notifyhold = yes ; Notify subscriptions on HOLD state (default: no)
; Turning on notifyringing and notifyhold will add a lot
; more database transactions if you are using realtime.
+;notifycid = yes ; Control whether caller ID information is sent along with
+ ; dialog-info+xml notifications (supported by snom phones).
+ ; Note that this feature will only work properly when the
+ ; incoming call is using the same extension and context that
+ ; is being used as the hint for the called extension. This means
+ ; that it won't work when using subscribecontext for your sip
+ ; user or peer (if subscribecontext is different than context).
+ ; This is also limited to a single caller, meaning that if an
+ ; extension is ringing because multiple calls are incoming,
+ ; only one will be used as the source of caller ID.
;limitonpeers = yes ; Apply call limits on peers only. This will improve
; status notification when you are using type=friend
; Inbound calls, that really apply to the user part
More information about the asterisk-commits
mailing list