On 3/22/06, Andrew Kohlsmith <[EMAIL PROTECTED]> wrote:
> On Wednesday 22 March 2006 05:26, Steve Davies wrote:
> > Another "hint" for getting hints working, although this only relates
> > to older 1.0.x versions of Asterisk (It is already fixed in 1.2.x) is
> > that status changes are not notified for channels where there is a
> > hyphen '-' in the channel name, so replacing all hyphens with
> > underscores in your sip.conf section names might prove useful :)
>
> That certainly seems to be a bug in my opinion.  If a hyphen is allowed in the
> name, it better damn well be allowed ANYWHERE a name is being passed.

I guess the devs agreed, as it is fixed in version 1.2.x :) In case it
helps anyone, attached is a crude replica of the 1.2 changes as
applies to 1.0.9

Steve
--- pbx.c~	2006-03-21 11:09:31.000000000 +0000
+++ pbx.c	2006-03-21 11:11:00.000000000 +0000
@@ -1455,7 +1455,7 @@
 	vsnprintf(device, sizeof(device), fmt, ap);
 	va_end(ap);
 
-	rest = strchr(device, '-');
+	rest = strrchr(device, '-');
 	if (rest) {
 		*rest = 0;
 	}
diff -ur channel.c~ channel.c
--- channel.c~	2006-03-21 14:18:58.000000000 +0000
+++ channel.c	2006-03-21 14:12:47.000000000 +0000
@@ -1983,7 +1983,7 @@
 	while (chan) {
 		strncpy(name, chan->name, sizeof(name)-1);
 		ast_mutex_unlock(&chan->lock);
-		cut = strchr(name,'-');
+		cut = strrchr(name,'-');
 		if (cut)
 		        *cut = 0;
 		if (!strcmp(name, device)) {
diff -ur channels/chan_sip.c~ channels/chan_sip.c
--- channels/chan_sip.c~	2006-03-21 14:18:58.000000000 +0000
+++ channels/chan_sip.c	2006-03-21 12:28:32.000000000 +0000
@@ -4401,7 +4401,7 @@
 	manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", p->name);
 	register_peer_exten(p, 0);
 	p->expire = -1;
-	ast_device_state_changed("SIP/%s", p->name);
+	ast_device_state_changed("SIP/%s-zzzz", p->name);
 	if (p->selfdestruct) {
 		p->delme = 1;
 		prune_peers();
@@ -5013,7 +5013,7 @@
 		}
 	}
 	if (!res) {
-	    ast_device_state_changed("SIP/%s", peer->name);
+	    ast_device_state_changed("SIP/%s-zzzz", peer->name);
 	}
 	if (res < 0)
 		transmit_response(p, "403 Forbidden", &p->initreq);
@@ -6751,7 +6751,7 @@
 			peer->lastms = pingtime;
 			peer->call = NULL;
 			if (statechanged) {
-				ast_device_state_changed("SIP/%s", peer->name);
+				ast_device_state_changed("SIP/%s-zzzz", peer->name);
 				if (newstate == 2) {
 					manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Lagged\r\nTime: %d\r\n", peer->name, pingtime);
 				} else {
@@ -8147,7 +8147,7 @@
 		sip_destroy(peer->call);
 	peer->call = NULL;
 	peer->lastms = -1;
-	ast_device_state_changed("SIP/%s", peer->name);
+	ast_device_state_changed("SIP/%s-zzzz", peer->name);
 	/* Try again quickly */
 	peer->pokeexpire = ast_sched_add(sched, DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer);
 	return 0;
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to