mal wieder Pickup LEDs an Snom370

EazyAdm

Neuer User
Mitglied seit
1 Jun 2005
Beiträge
109
Punkte für Reaktionen
0
Punkte
0
Hallo,

wir sind umgezogen und haben in diesem Zug nun endlich eine Asterisk für das gesamte Unternehmen am laufen. Das System funktioniert super nur mit den Snom LED's habe ich meine Probleme.

Wir haben einen Asterisk 1.4.18 inzwischen mit dem DEVSTATE Patch am laufen. Ich bekomme Ihn nur leider nicht dazu Überredet das meine Telefone einen Notify bekommen wenn an einem anderen Telefen telefoniert wird. Um alle Fehlerquellen auszuschliessen habe ich nun den Samstag genutzt und die sip.conf sowie die extensions.conf auf das nötigste runtergebrochen.

sip.conf
Code:
[general]
bindport=5060
srvlookup=yes
disallow=all
allow=ulaw
allow=gsm
language=de
canreinvite=no
;tos=lowdelay
allowsubscribe=yes
notifyringing=yes
useclientcode=yes

[252]
type=friend
username=252
secret=xxx
host=dynamic
callerid=Test User1 <252>
pickupgroup=1
callgroup=1
context=mars
subscribecontext=mars
qualify = yes

[254]
type=friend
username=254
secret=xxx
host=dynamic
callerid=Test User2 <254>
pickupgroup=1
callgroup=1
context=mars
subscribecontext=mars
qualify = yes

[260]
type=friend
username=260
secret=xxx
host=dynamic
callerid=Test User3 <260>
pickupgroup=1
callgroup=1
context=mars
subscribecontext=mars
qualify = yes

extensions.conf
Code:
[mars]
exten => 252,hint,SIP/252
exten => 252,1,DIAL(SIP/252)
exten => 252,2,Hangup

exten => 254,hint,SIP/254
exten => 254,1,DIAL(SIP/254)
exten => 254,2,Hangup

exten => 260,hint,SIP/260
exten => 260,1,DIAL(SIP/260)
exten => 260,2,Hangup

In den 3 Snom370 Telefonen habe ich in den FunctionKeys jeweils für jedes Telefon eine Extension eingetragen sowie Filter Packets from Registrar deaktivert
Code:
fkey0!: dest <sip:[email protected];user=phone>|*8
fkey6!: dest <sip:[email protected];user=phone>|*8
filter_registrar!: off

Auf den Telefonen läuft die Firmware snom370-SIP 7.1.30

Wenn ich auf dem Asterisk "sip show subscriptions" ausführe bekomme ich einen Output der mir nicht ganz passt. Denn auf dem Telefon von User 260 sind eigentlich auch 2 Einträge in den Funktion Keys
Code:
Peer             User        Call ID      Extension        Last state     Type            Mailbox
192.168.5.181    260         3c26701759c  260@mars         Idle           dialog-info+xml <none>
192.168.5.115    252         3c267028a1f  260@mars         Idle           dialog-info+xml <none>
192.168.5.115    252         3c267028a26  254@mars         Idle           dialog-info+xml <none>
3 active SIP subscriptions

Wenn ich mir Beiträge in Foren und Blogs auf Google anschaue, bin ich der Meinung das meine Config, zumal ich diese im Moment ja auf 3 Telefone runter gebrochen habe absolut korrekt ist. Was jedoch dagegen spricht ist die Tatsache das es nicht geht und das ich nur 3 von 4 Subscriptions sehe.

Ich wäre euch für Ideen und Vorschläge super dankbar. Mit der aktuellsten Asterisk 1.2 hatte ich es auch schon versucht, leider mit dem gleichen Ergebnis.

Vielen Dank

bye
eazy
 
Ich vermute einen Fehler bei der Belegung der Funktionstasten auf dem Telefon mit der 260. Falls du das auschließen kannst schau dir den SIP Trace an und vergleiche diesen mit dem von dem Telefon das funktioniert. Eventuell - aber in diesem Fall eher unwahrscheinlich - könnte auch das user=phone als fehlerquelle in Frage kommen.
 
call-limit und incominglimit fehlen in deiner sip.conf.

Gruß Fabian
 
musste mich die Tage auch mal mit snom-Telefonen beschäftigen.
Ich habe den aktuellen bristuff-0.4.0-test6 mit eineigen eigenen Anpassungen (u.a. mit dialog-info für pickup)
Das funktioniert auch alles super, nur eines nicht. Nach einem Restart des phones wird keine neue subscription ausgelöst und das ist leider das Problem was ich nicht lösen kann.

Kann bei gelegenheit auch mal ein Patch dazu veröffentlichen
 
ich habe auch lange rum getahn aber seit heute funst es
Code:
sip.conf 

[general]
context=default
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
language=de
allow=alaw
allow=ulaw
[B]allowsubscribe=yes
notifyringing=yes
notifyhold=yes
useclientcode=yes
limitonpeers = yes[/B]

[20]
callerid= 20 <20>
host=dynamic
domain=192.168.0.23
user=20
secret=20
type=friend
mailbox=20
nat=yes
canreinvite=no
[B]subscribecontext=meine-telefone
call-limit=4[/B]


extension.conf



[B]
[hint]
[meine-telefone]
exten => 20,hint,SIP/20
exten => 21,hint,SIP/21
exten => 22,hint,SIP/22
exten => 23,hint,SIP/23
exten => 24,hint,SIP/24
exten => 25,hint,SIP/25
exten => 26,hint,SIP/26
exten => 27,hint,SIP/27
exten => 28,hint,SIP/28
exten => 29,hint,SIP/29
exten => 30,hint,SIP/30
exten => 31,hint,SIP/31
exten => 32,hint,SIP/32
exten => 33,hint,SIP/33
exten => 34,hint,SIP/34
exten => 35,hint,SIP/35
exten => 36,hint,SIP/36
exten => 37,hint,SIP/37
exten => 38,hint,SIP/38
exten => 39,hint,SIP/39
exten => 54,hint,SIP/54[/B]


[default]
include => lokal
include => out
include => in
include => echotest
include => mailbox
include => mailbox_own
inklude => musik
inklude => gruppe
inklude => pickup
[B]inklude => hint[/B]
 
nur so zur info, keine gute idee out in den default-context zu includieren.
 
wiso ??? damit übergebe ich meine ausgehenden aneufe an meinen sip proxy
 
und was steht in der sip.conf unter [general] als context?
Bestimmt default - oder?
Somit ist es auch für nicht angemeldete User möglich eine externe Verbuíndung aufzubauen, also über deinen sip proxy zu telefonieren.

Ist das gewollt?
 
verstehe ich nicht ganz wie dass gehen soll

mein Lancom läst nur die asterisk server als sip pbx leitung zu

und wie soll ich dan ohne anmelden telefoniren können

bzw wie soll ich es anders lösen ???
 
@garfield0815:
Sind useclientcode=yes und call-limit=4 wirklich notwenig?
Ich hab das mit der Anzeige im Display noch nie hinbekommen und auch chaos2000 hat vermutlich die Sourcen gepatcht!

@chaos2000:
Was hast Du jetzt genau geändert damit in den SNOM-Displays auch der PickUp-Info erscheint?

Grüße,
DomRoc
 
ich habe nichts gepatcht
nur
useclientcode=yes und call-limit=4

eingebaut und es funst
 
ich habe nichts gepatcht
nur
useclientcode=yes und call-limit=4

eingebaut und es funst


Hi,

entschuldigung, ich hab da wohl zu viel reininterpretiert. Bei Dir gehen jetzt also die BLF, also die Lämpchen der Funktionstasten für die überwachten Nebenstellen, oder?

Weil die SNOMs ja bei vorhandener Subscription auch noch diverse Infos auf dem Display anzeigen können (wer ruft wen an usw.), allerdings wohl nur, wenn man sein Asterisk irgendwie patcht, damit die Dialog Infos und XML auch gesendet wird.

Grüße,
DomRoc
 
Bei mir funktioniert die Call-Pickup-Anzeige der Nummer im Display mit dem aktuellen Bristuff auch nicht. Ich erinnere mich dunkel, dass das mit einer älteren Asterisk-Bristuff-Version und älteren Snom Firmwares mal funktioniert hat. Ohne Patch! Ich kann aber leider nicht sagen, ob die Funktionalität nach einem Asterisk- oder einem Snom-Firmwareupdate verloren gegangen ist.

An einer Lösung wäre ich auch sehr interessiert.
 
dazu ist ein patch nötig.
ich veröffentliche diesen noch im Laufe dieser Woche.
Wird für bristuff-0.4.0-test6 sein
 
Die Snoms machen probleme, wenn mehr als 5 telefone überwacht werden und ringing signalisiert wird, dann kommen die total aus dem trott.
 
Die Snoms oder der Asterisk? Den Snoms sollte das doch eigentlich egal sein, wieviele Kollegen, neben ihnen, noch diese Extension überwachen. Willst du den Patch wie er jetzt ist mal posten, dass ein paar mehr Augen mal drüber gucken können?
 
Den Snoms ist das nicht egal.
Situation ist folgende:
Ankommender Anruf klingelt in Ringgroup1 das sind z.B. 2 Phones, kein Problem.
Danach wir dieser auf Ringgroup2 weitergeleitet, es klingen 7 phones und jedes phone überwacht auch die anderen. Somit kommen an jedem phone 6 nachrichten an das es xy am phone x anruft.
Damit sind die telefone total überlastert. Den patch schickt lade ich hoch wenn ich @home bin
 
Patch:
Code:
diff -Naur bristuff-0.4.0-test6/asterisk/channels/chan_sip.c asterisk-1.4.17/channels/chan_sip.c
--- bristuff-0.4.0-test6/asterisk/channels/chan_sip.c	2008-04-29 17:13:23.000000000 +0200
+++ asterisk-1.4.17/channels/chan_sip.c	2008-04-06 17:51:14.000000000 +0200
@@ -288,7 +288,8 @@
 	DIALOG_INFO_XML,
 	CPIM_PIDF_XML,
 	PIDF_XML,
-	MWI_NOTIFICATION
+	MWI_NOTIFICATION,
+	DIALOG_RLMI_XML
 };
 
 static const struct cfsubscription_types {
@@ -303,7 +304,8 @@
 	{ CPIM_PIDF_XML,   "presence", "application/cpim-pidf+xml",   "cpim-pidf+xml" },  /* RFC 3863 */
 	{ PIDF_XML,        "presence", "application/pidf+xml",        "pidf+xml" },       /* RFC 3863 */
 	{ XPIDF_XML,       "presence", "application/xpidf+xml",       "xpidf+xml" },       /* Pre-RFC 3863 with MS additions */
-	{ MWI_NOTIFICATION,	"message-summary", "application/simple-message-summary", "mwi" } /* RFC 3842: Mailbox notification */
+	{ MWI_NOTIFICATION,	"message-summary", "application/simple-message-summary", "mwi" }, /* RFC 3842: Mailbox notification */
+	{ DIALOG_RLMI_XML, "dialog",   "multipart/related;boundary=UniqueAsteriskRLMIBoundary;type=application/rlmi+xml", "application/rlmi+xml" } /* RFC 4662 */
 };
 
 /*! \brief SIP Request methods known by Asterisk */
@@ -455,7 +457,7 @@
 	/* RFC3329: Security agreement mechanism */
 	{ SIP_OPT_SEC_AGREE,	NOT_SUPPORTED,	"sec_agree" },
 	/* SIMPLE events:  RFC4662 */
-	{ SIP_OPT_EVENTLIST,	NOT_SUPPORTED,	"eventlist" },
+	{ SIP_OPT_EVENTLIST,	SUPPORTED,	"eventlist" },
 	/* GRUU: Globally Routable User Agent URI's */
 	{ SIP_OPT_GRUU,		NOT_SUPPORTED,	"gruu" },
 	/* RFC4538: Target-dialog */
@@ -898,6 +900,33 @@
 	enum referstatus status;			/*!< REFER status */
 };
 
+struct sip_evcalls {
+	int stateid;				/*!< SUBSCRIBE: ID for devicestate subscriptions */
+	int laststate;				/*!< SUBSCRIBE: Last known extension state */
+	int dialogver;				/*!< SUBSCRIBE: Version for subscription dialog-info */
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(exten);	/*!< Exten to watch */
+		AST_STRING_FIELD(name);		/*!< Name of user to program */
+		AST_STRING_FIELD(uri);		/*!< Original requested URI */
+		AST_STRING_FIELD(contentid);	/*!< Dialogue Content ID */
+	);
+	AST_LIST_ENTRY(sip_evcalls) list;	/*!< List mechanics*/
+};
+
+AST_LIST_HEAD_STATIC(calllist, sip_evcalls);	/*!< List of calls */
+
+struct sip_eventlist {
+	ast_mutex_t lock;                       /*!< Dialog private lock */
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(exten);	/*!< Extension to notify */
+		AST_STRING_FIELD(supported);	/*!< Supported formats */
+		AST_STRING_FIELD(uri);		/*!< Supported formats */
+	);
+	unsigned long version;			/*! <Version number as per RFC4662 */
+	struct calllist	calls;
+};
+
+
 /*! \brief sip_pvt: PVT structures are used for each SIP dialog, ie. a call, a registration, a subscribe  */
 static struct sip_pvt {
 	ast_mutex_t lock;			/*!< Dialog private lock */
@@ -1013,6 +1042,7 @@
 	struct ast_variable *chanvars;		/*!< Channel variables to set for inbound call */
 	struct sip_pvt *next;			/*!< Next dialog in chain */
 	struct sip_invite_param *options;	/*!< Options for INVITE */
+	struct sip_eventlist *eventlist;	/*!< Is this a member of a subscription list and if so deal with it correctly */ 
 	int autoframing;
 } *iflist = NULL;
 
@@ -1477,7 +1507,7 @@
 static int get_destination(struct sip_pvt *p, struct sip_request *oreq);
 static int get_msg_text(char *buf, int len, struct sip_request *req);
 static void free_old_route(struct sip_route *route);
-static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout);
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout, char *cid_num, char *cid_name);
 
 /*--- Constructing requests and responses */
 static void initialize_initreq(struct sip_pvt *p, struct sip_request *req);
@@ -2064,7 +2094,8 @@
 
 	/* If this is a subscription, tell the phone that we got a timeout */
 	if (p->subscribed) {
-		transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, TRUE);	/* Send last notification */
+		//transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, TRUE);	/* Send last notification */
+		transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, TRUE, NULL, NULL);	/* Send last notification */
 		p->subscribed = NONE;
 		append_history(p, "Subscribestatus", "timeout");
 		if (option_debug > 2)
@@ -3140,6 +3171,14 @@
 		ast_variables_destroy(p->chanvars);
 		p->chanvars = NULL;
 	}
+	if (p->eventlist) {
+		struct sip_evcalls *evsub = NULL;
+		AST_LIST_LOCK(&p->eventlist->calls);
+		while ((evsub = AST_LIST_REMOVE_HEAD(&p->eventlist->calls, list)))
+			free(evsub);
+		AST_LIST_UNLOCK(&p->eventlist->calls);
+		free(p->eventlist);
+	}
 	ast_mutex_destroy(&p->lock);
 
 	ast_string_field_free_memory(p);
@@ -3168,6 +3207,7 @@
 	int outgoing = ast_test_flag(&fup->flags[1], SIP_PAGE2_OUTGOING_CALL);
 	struct sip_user *u = NULL;
 	struct sip_peer *p = NULL;
+	struct ast_channel *chan;
 
 	if (option_debug > 2)
 		ast_log(LOG_DEBUG, "Updating call counter for %s call\n", outgoing ? "outgoing" : "incoming");
@@ -3267,7 +3307,15 @@
 		ast_log(LOG_ERROR, "update_call_counter(%s, %d) called with no event!\n", name, event);
 	}
 	if (p) {
-		ast_device_state_changed("SIP/%s", p->name);
+		//ast_device_state_changed("SIP/%s", p->name);
+		chan = fup->owner;
+		if (!chan)
+			ast_device_state_changed("SIP/%s", p->name);
+		else {
+			if (option_debug > 0)
+				ast_log(LOG_DEBUG, "State of SIP/%s changed - Caller: %s <%s>\n", p->name, chan->cid.cid_name, chan->cid.cid_num);
+			ast_device_state_changed_with_callerid("SIP/%s", chan->cid.cid_num, chan->cid.cid_name, p->name);
+		}
 		ASTOBJ_UNREF(p, sip_destroy_peer);
 	} else /* u must be set */
 		ASTOBJ_UNREF(u, sip_destroy_user);
@@ -5832,6 +5880,14 @@
 			char contact[BUFSIZ];
 			snprintf(contact, sizeof(contact), "%s;expires=%d", p->our_contact, p->expiry);
 			add_header(resp, "Contact", contact);	/* Not when we unregister */
+			if (!p->sipoptions) {
+				const char *supported = get_header(req, "Supported");
+				if (!ast_strlen_zero(supported)) {
+					parse_sip_options(p, supported);
+					if (p->sipoptions == SIP_OPT_EVENTLIST)
+						add_header(resp, "Require", "eventlist");		/* Require Eventlist */
+				}
+			}
 		}
 	} else if (msg[0] != '4' && !ast_strlen_zero(p->our_contact)) {
 		add_header(resp, "Contact", p->our_contact);
@@ -7091,9 +7147,10 @@
 }
 
 /*! \brief Used in the SUBSCRIBE notification subsystem */
-static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout)
+//static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout)
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout, char *cid_num, char *cid_name)
 {
-	char tmp[4000], from[256], to[256];
+	char tmp[16000], from[256], to[256];
 	char *t = tmp, *c, *mfrom, *mto;
 	size_t maxbytes = sizeof(tmp);
 	struct sip_request req;
@@ -7103,6 +7160,10 @@
 	enum state { NOTIFY_OPEN, NOTIFY_INUSE, NOTIFY_CLOSED } local_state = NOTIFY_OPEN;
 	char *pidfstate = "--";
 	char *pidfnote= "Ready";
+	struct sip_eventlist *evl=p->eventlist;
+
+	if (!cid_num  || ast_strlen_zero(cid_num )) cid_num  = "unknown";
+	if (!cid_name || ast_strlen_zero(cid_name)) cid_name = "unknown";
 
 	memset(from, 0, sizeof(from));
 	memset(to, 0, sizeof(to));
@@ -7134,7 +7195,8 @@
 		pidfnote = "On the phone";
 		break;
 	case AST_EXTENSION_UNAVAILABLE:
-		statestring = "terminated";
+		//statestring = "terminated";
+		statestring = "confirmed";
 		local_state = NOTIFY_CLOSED;
 		pidfstate = "away";
 		pidfnote = "Unavailable";
@@ -7150,7 +7212,8 @@
 		/* Default setting */
 		break;
 	}
-
+	ast_log(LOG_WARNING, "Statstring of %d is %s\n", state, statestring);
+	ast_verbose("Statstring of %d is %s\n", state, statestring );
 	subscriptiontype = find_subscription_type(p->subscribed);
 	
 	/* Check which device/devices we are watching  and if they are registered */
@@ -7209,14 +7272,142 @@
 		add_header(&req, "Subscription-State", "terminated;reason=noresource");
 		break;
 	default:
-		if (p->expiry)
+		if ((p->expiry) || (p->eventlist))
 			add_header(&req, "Subscription-State", "active");
 		else	/* Expired */
 			add_header(&req, "Subscription-State", "terminated;reason=timeout");
 	}
 	switch (p->subscribed) {
-	case XPIDF_XML:
+	case DIALOG_RLMI_XML: /* RFC 4662 */
+		if (!evl)
+			break;
+
+		struct sip_evcalls *newcall = NULL;
+		
+		add_header(&req, "Require", "eventlist");
+
+                struct ast_config *blflist_config = ast_load_realtime_multientry("blflist", "exten LIKE", "%", "peer", p->exten, NULL);
+		const char *blfpeer=NULL;
+                if (!blflist_config) {
+                       ast_log(LOG_ERROR, "no blflist defined in your config (extconfig.conf).\n");
+                } else {
+			const char *blfexten;
+			char slist[4000],diapart[4000],dialist[4000];
+			char *lst = slist, *dp = diapart, *dl = dialist;
+			size_t listbytes = sizeof(slist), dpbytes = sizeof(diapart), dlbytes = sizeof(dialist);
+
+			ast_build_string(&lst, &listbytes, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+			ast_build_string(&lst, &listbytes, "<list xmlns=\"urn:ietf:params:xml:ns:rlmi\" uri=\"%s\" version=\"%ld\" fullState=\"true\">\n",mto,evl->version++);
+                        while ((blfpeer = ast_category_browse(blflist_config, blfpeer))) {
+				blfexten=ast_variable_retrieve(blflist_config, blfpeer, "exten");
+				
+				AST_LIST_LOCK(&evl->calls);
+			        AST_LIST_TRAVERSE_SAFE_BEGIN(&evl->calls, newcall, list) {
+					if ((newcall) && (!strcasecmp(newcall->exten, blfexten)))
+						break;
+				}
+        			AST_LIST_TRAVERSE_SAFE_END
+
+				if (!newcall) {
+					newcall=ast_calloc(1,sizeof(struct sip_evcalls));
+					ast_string_field_init(newcall, 512);
+					ast_string_field_set(newcall, exten, blfexten);
+					ast_string_field_build(newcall, uri, "%s@%s", blfexten, p->fromdomain);
+					ast_string_field_set(newcall, name, ast_variable_retrieve(blflist_config, blfpeer, "name"));
+					AST_LIST_INSERT_TAIL(&evl->calls, newcall, list);
+					newcall->stateid = ast_extension_state_add(p->context, newcall->exten, cb_extensionstate, p);
+				}
+
+				ast_string_field_build(newcall, contentid, "%08lx", ast_random());
+
+
+				if (!strcasecmp(evl->exten,blfexten)) {
+					ast_log(LOG_WARNING,"Found target exten for update %s set state info/delete\n",evl->exten);
+					newcall->laststate=state;
+				}
+				switch (newcall->laststate) {
+					case (AST_EXTENSION_RINGING | AST_EXTENSION_INUSE):
+						statestring = (global_notifyringing) ? "early" : "confirmed";
+						local_state = NOTIFY_INUSE;
+						pidfstate = "busy";
+						pidfnote = "Ringing";
+						break;
+					case AST_EXTENSION_RINGING:
+						statestring = "early";
+						local_state = NOTIFY_INUSE;
+						pidfstate = "busy";
+						pidfnote = "Ringing";
+						break;
+					case AST_EXTENSION_INUSE:
+						statestring = "confirmed";
+						local_state = NOTIFY_INUSE;
+						pidfstate = "busy";
+						pidfnote = "On the phone";
+						break;
+					case AST_EXTENSION_BUSY:
+						statestring = "confirmed";
+						local_state = NOTIFY_CLOSED;
+						pidfstate = "busy";
+						pidfnote = "On the phone";
+						break;
+					case AST_EXTENSION_UNAVAILABLE:
+						statestring = "terminated";
+						local_state = NOTIFY_CLOSED;
+						pidfstate = "away";
+						pidfnote = "Unavailable";
+						break;
+					case AST_EXTENSION_ONHOLD:
+						statestring = "confirmed";
+						local_state = NOTIFY_INUSE;
+						pidfstate = "busy";
+						pidfnote = "On Hold";
+						break;
+					case AST_EXTENSION_NOT_INUSE:
+					default:
+						statestring = "terminated";
+						local_state = NOTIFY_OPEN;
+						pidfstate = "--";
+						pidfnote= "Ready";
+						/* Default setting */
+						break;
+				}
+
+				ast_build_string(&lst, &listbytes, "<resource uri=\"sip:%s\"><name>%s</name>",newcall->uri,newcall->name);
+				ast_build_string(&lst, &listbytes, "<instance id=\"%08lx\" state=\"active\" cid=\"%s\"/></resource>\n",ast_random(),newcall->contentid);
+
+				ast_build_string(&dp, &dpbytes, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+				ast_build_string(&dp, &dpbytes, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">", newcall->dialogver++, full ? "full":"partial", newcall->uri);
+				ast_build_string(&dp, &dpbytes, "<dialog id=\"%s\">", newcall->exten);
+				ast_build_string(&dp, &dpbytes, "<state>%s</state><local>", statestring);
+				if (state == AST_EXTENSION_ONHOLD) {
+					ast_build_string(&dp, &dpbytes, "<target uri=\"sip:%s\"><param pname=\"+sip.rendering\" pvalue=\"no\"></target>", newcall->uri);
+				}
+				ast_build_string(&dp, &dpbytes, "<identity display=\"%s\">sip:%s</identity>",newcall->name,newcall->uri);
+                		ast_build_string(&dp, &dpbytes, "</local></dialog></dialog-info>\n");
+		
+				ast_build_string(&dl, &dlbytes, "Content-Type:application/dialog-info+xml\n");
+				ast_build_string(&dl, &dlbytes, "Content-Length:%i\n",strlen(diapart));
+				ast_build_string(&dl, &dlbytes, "Content-ID:<%s>\n\n",newcall->contentid);
+				ast_build_string(&dl, &dlbytes, diapart);
+				ast_build_string(&dl, &dlbytes, "--UniqueAsteriskRLMIBoundary\n");
+				dp=diapart;
+				dpbytes=sizeof(diapart);
+
+				AST_LIST_UNLOCK(&evl->calls);
+                        }
+			ast_build_string(&lst, &listbytes, "</list>\n");
+
+			ast_build_string(&t, &maxbytes, "--UniqueAsteriskRLMIBoundary\n");
+			ast_build_string(&t, &maxbytes, "Content-Type:application/rlmi+xml\n");
+			ast_build_string(&t, &maxbytes, "Content-Length:%i\n",strlen(slist));
+			ast_build_string(&t, &maxbytes, "Content-ID:<%08lx>\n\n",ast_random());
+			ast_build_string(&t, &maxbytes, slist);
+			ast_build_string(&t, &maxbytes, "--UniqueAsteriskRLMIBoundary\n");
+			ast_build_string(&t, &maxbytes, dialist);
+                }
+		break;
 	case CPIM_PIDF_XML:
+	case XPIDF_XML:
 		ast_build_string(&t, &maxbytes, "<?xml version=\"1.0\"?>\n");
 		ast_build_string(&t, &maxbytes, "<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n");
 		ast_build_string(&t, &maxbytes, "<presence>\n");
@@ -7224,12 +7415,20 @@
 		ast_build_string(&t, &maxbytes, "<atom id=\"%s\">\n", p->exten);
 		ast_build_string(&t, &maxbytes, "<address uri=\"%s;user=ip\" priority=\"0.800000\">\n", mto);
 		ast_build_string(&t, &maxbytes, "<status status=\"%s\" />\n", (local_state ==  NOTIFY_OPEN) ? "open" : (local_state == NOTIFY_INUSE) ? "inuse" : "closed");
-		ast_build_string(&t, &maxbytes, "<msnsubstatus substatus=\"%s\" />\n", (local_state == NOTIFY_OPEN) ? "online" : (local_state == NOTIFY_INUSE) ? "onthephone" : "offline");
+		//ast_build_string(&t, &maxbytes, "<msnsubstatus substatus=\"%s\" />\n", (local_state == NOTIFY_OPEN) ? "online" : (local_state == NOTIFY_INUSE) ? "onthephone" : "offline");
+		if (p->subscribed == XPIDF_XML) {  /* MS additions */
+			ast_build_string(&t, &maxbytes, "<msnsubstatus substatus=\"%s\" />\n", (local_state == NOTIFY_OPEN) ? "online" : (local_state == NOTIFY_INUSE) ? "onthephone" : "offline");
+		}
 		ast_build_string(&t, &maxbytes, "</address>\n</atom>\n</presence>\n");
 		break;
 	case PIDF_XML: /* Eyebeam supports this format */
 		ast_build_string(&t, &maxbytes, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
-		ast_build_string(&t, &maxbytes, "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \nxmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\"\nxmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\"\nxmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\"\nentity=\"%s\">\n", mfrom);
+		//ast_build_string(&t, &maxbytes, "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \nxmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\"\nxmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\"\nxmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\"\nentity=\"%s\">\n", mfrom);
+		ast_build_string(&t, &maxbytes, "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n"
+		                                     "xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\"\n"
+		                                     "xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\"\n"
+		                                     "xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\"\n"
+		                                     "entity=\"%s\">\n", mfrom);
 		ast_build_string(&t, &maxbytes, "<pp:person><status>\n");
 		if (pidfstate[0] != '-')
 			ast_build_string(&t, &maxbytes, "<ep:activities><ep:%s/></ep:activities>\n", pidfstate);
@@ -7246,16 +7445,19 @@
 	case DIALOG_INFO_XML: /* SNOM subscribes in this format */
 		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)
+		if ((state & AST_EXTENSION_RINGING) && global_notifyringing){
 			ast_build_string(&t, &maxbytes, "<dialog id=\"%s\" direction=\"recipient\">\n", p->exten);
-		else
+			ast_build_string(&t, &maxbytes, "<local><identity display=\"%s\">%s</identity><target uri=\"%s\"/></local>\n", p->exten, mto, mto);
+			ast_build_string(&t, &maxbytes, "<remote><identity display=\"%s\">%s</identity><target uri=\"sip:%s%s@%s\"/></remote>\n", cid_name, cid_num, ast_pickup_ext(), p->exten, p->fromdomain);
+		} else if (state == AST_EXTENSION_ONHOLD) {
 			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_ONHOLD) {
 			ast_build_string(&t, &maxbytes, "<local>\n<target uri=\"%s\">\n"
 			                                "<param pname=\"+sip.rendering\" pvalue=\"no\">\n"
 			                                "</target>\n</local>\n", mto);
+		} else {
+			ast_build_string(&t, &maxbytes, "<dialog id=\"%s\">\n", p->exten);
 		}
+		ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
 		ast_build_string(&t, &maxbytes, "</dialog>\n</dialog-info>\n");
 		break;
 	case NONE:
@@ -8465,6 +8667,17 @@
 
 	ast_mutex_lock(&p->lock);
 
+	if ((p->eventlist) && (p->subscribed != NONE)) {
+		ast_mutex_lock(&p->eventlist->lock);
+		ast_string_field_set(p->eventlist, exten, exten);
+		transmit_state_notify(p, state, 1, FALSE, cid_num, cid_name);
+		ast_mutex_unlock(&p->eventlist->lock);
+		if (option_verbose > 1)
+			ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
+		ast_mutex_unlock(&p->lock);
+		return 0;
+	}
+
 	switch(state) {
 	case AST_EXTENSION_DEACTIVATED:	/* Retry after a while */
 	case AST_EXTENSION_REMOVED:	/* Extension is gone */
@@ -8481,7 +8694,7 @@
 		break;
 	}
 	if (p->subscribed != NONE)	/* Only send state NOTIFY if we know the format */
-		transmit_state_notify(p, state, 1, FALSE);
+		transmit_state_notify(p, state, 1, FALSE, cid_num, cid_name);
 
 	if (option_verbose > 1)
 		ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
@@ -10711,6 +10924,8 @@
 	struct sip_pvt *cur;
 	int numchans = 0;
 	char *referstatus = NULL;
+	struct sip_eventlist *evl;
+	struct sip_evcalls *newcall;
 
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
@@ -10721,6 +10936,7 @@
 	else 
 		ast_cli(fd, FORMAT3, "Peer", "User", "Call ID", "Extension", "Last state", "Type", "Mailbox");
 	for (; cur; cur = cur->next) {
+		evl = cur->eventlist;
 		referstatus = "";
 		if (cur->refer) { /* SIP transfer in progress */
 			referstatus = referstatus2str(cur->refer->status);
@@ -10740,16 +10956,45 @@
 			numchans++;
 		}
 		if (cur->subscribed != NONE && subscriptions) {
-			ast_cli(fd, FORMAT3, ast_inet_ntoa(cur->sa.sin_addr),
-				S_OR(cur->username, S_OR(cur->cid_num, "(None)")), 
-			   	cur->callid,
-				/* the 'complete' exten/context is hidden in the refer_to field for subscriptions */
-				cur->subscribed == MWI_NOTIFICATION ? "--" : cur->subscribeuri,
-				cur->subscribed == MWI_NOTIFICATION ? "<none>" : ast_extension_state2str(cur->laststate), 
-				subscription_type2str(cur->subscribed),
-				cur->subscribed == MWI_NOTIFICATION ? (cur->relatedpeer ? cur->relatedpeer->mailbox : "<none>") : "<none>"
-);
+//			ast_cli(fd, FORMAT3, ast_inet_ntoa(cur->sa.sin_addr),
+//				S_OR(cur->username, S_OR(cur->cid_num, "(None)")), 
+//			   	cur->callid,
+//				/* the 'complete' exten/context is hidden in the refer_to field for subscriptions */
+//				cur->subscribed == MWI_NOTIFICATION ? "--" : cur->subscribeuri,
+//				cur->subscribed == MWI_NOTIFICATION ? "<none>" : ast_extension_state2str(cur->laststate), 
+//				subscription_type2str(cur->subscribed),
+//				cur->subscribed == MWI_NOTIFICATION ? (cur->relatedpeer ? cur->relatedpeer->mailbox : "<none>") : "<none>"
+//			);
 			numchans++;
+			if (! evl) {
+				ast_cli(fd, FORMAT3, ast_inet_ntoa(cur->sa.sin_addr),
+					S_OR(cur->username, S_OR(cur->cid_num, "(None)")), 
+				   	cur->callid,
+					/* the 'complete' exten/context is hidden in the refer_to field for subscriptions */
+					cur->subscribed == MWI_NOTIFICATION ? "--" : cur->subscribeuri,
+					cur->subscribed == MWI_NOTIFICATION ? "<none>" : ast_extension_state2str(cur->laststate), 
+					subscription_type2str(cur->subscribed),
+					cur->subscribed == MWI_NOTIFICATION ? (cur->relatedpeer ? cur->relatedpeer->mailbox : "<none>") : "<none>");
+				numchans++;
+			} else {
+				ast_mutex_lock(&evl->lock);
+				AST_LIST_LOCK(&evl->calls);
+				AST_LIST_TRAVERSE(&evl->calls, newcall, list) {
+					if (newcall) {
+						ast_cli(fd, FORMAT3, ast_inet_ntoa(cur->sa.sin_addr),
+							S_OR(cur->username, S_OR(cur->cid_num, "(None)")), 
+						   	cur->callid,
+							/* the 'complete' exten/context is hidden in the refer_to field for subscriptions */
+							cur->subscribed == MWI_NOTIFICATION ? "--" : newcall->exten,
+							cur->subscribed == MWI_NOTIFICATION ? "<none>" : ast_extension_state2str(newcall->laststate), 
+							subscription_type2str(cur->subscribed),
+							cur->subscribed == MWI_NOTIFICATION ? (cur->relatedpeer ? cur->relatedpeer->mailbox : "<none>") : "<none>");
+						numchans++;
+					}
+				}
+				AST_LIST_UNLOCK(&evl->calls);
+				ast_mutex_unlock(&evl->lock);
+			}
 		}
 	}
 	ast_mutex_unlock(&iflock);
@@ -14852,7 +15097,17 @@
 		/* Polycom phones only handle xpidf+xml, even if they say they can
 		   handle pidf+xml as well
 		*/
-		if (strstr(p->useragent, "Polycom")) {
+		if (strstr(accept, "application/rlmi+xml")) {
+			if (!p->eventlist) {
+				p->eventlist=ast_calloc(1,sizeof(struct sip_eventlist));
+				ast_mutex_init(&p->eventlist->lock);
+				p->eventlist->version=0;
+				ast_string_field_init(p->eventlist,512);
+				AST_LIST_HEAD_INIT(&p->eventlist->calls);
+				ast_string_field_set(p->eventlist, supported, accept);
+			}
+			p->subscribed = DIALOG_RLMI_XML;
+		} else if (strstr(p->useragent, "Polycom")) {
 			p->subscribed = XPIDF_XML;
 		} else if (strstr(accept, "application/pidf+xml")) {
 			p->subscribed = PIDF_XML;         /* RFC 3863 format */
@@ -14965,7 +15220,6 @@
 			struct sip_pvt *p_old;
 
 			if ((firststate = ast_extension_state(NULL, p->context, p->exten)) < 0) {
-
 				ast_log(LOG_NOTICE, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension.\n", p->exten, p->context, ast_inet_ntoa(p->sa.sin_addr));
 				transmit_response(p, "404 Not found", req);
 				ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
@@ -14973,7 +15227,7 @@
 			}
 
 			transmit_response(p, "200 OK", req);
-			transmit_state_notify(p, firststate, 1, FALSE);	/* Send first notification */
+			transmit_state_notify(p, firststate, 1, FALSE, NULL, NULL);	/* Send first notification */
 			append_history(p, "Subscribestatus", "%s", ast_extension_state2str(firststate));
 			/* hide the 'complete' exten/context in the refer_to field for later display */
 			ast_string_field_build(p, subscribeuri, "%s@%s", p->exten, p->context);
 
Hallo chaos2002,

wollte das ganze mal beim test6-xr2 nachpfelgen, bekomme dann aber folgende Meldungen beim Kompilieren:

[CC] chan_sip.c -> chan_sip.o
chan_sip.c: In function 'update_call_counter':
chan_sip.c:3318: warning: implicit declaration of function 'ast_device_state_changed_with_callerid'
chan_sip.c: In function 'cb_extensionstate':
chan_sip.c:8685: error: 'cid_num' undeclared (first use in this function)
chan_sip.c:8685: error: (Each undeclared identifier is reported only once
chan_sip.c:8685: error: for each function it appears in.)
chan_sip.c:8685: error: 'cid_name' undeclared (first use in this function)
make[1]: *** [chan_sip.o] Fehler 1
make: *** [channels] Fehler 2

Die warning wird wohl egal sein, aber warum kommt der Fehler mit den undeklarierten CallerID-Variablen?


Die transmit_state_notify-Funktion wurde natürlich nach Deinem Patch mit folgenden Zeilen angepasst:

struct sip_eventlist *evl=p->eventlist;

if (!cid_num || ast_strlen_zero(cid_num )) cid_num = "unknown";
if (!cid_name || ast_strlen_zero(cid_name)) cid_name = "unknown";


Müsste doch eigentlich passen: Wenn die Variablen NULL sind, werden sie auf unknown gesetzt!


Schöne Grüße,
DomRoc
 

Zurzeit aktive Besucher

Statistik des Forums

Themen
246,197
Beiträge
2,247,888
Mitglieder
373,755
Neuestes Mitglied
grdex
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.