Index: asterisk-1.2.24.dfsg+pf.0.1~svn1329/channels/chan_sip.c
===================================================================
--- asterisk-1.2.24.dfsg+pf.0.1~svn1329.orig/channels/chan_sip.c 2007-08-20 17:56:17.000000000 +0200
+++ asterisk-1.2.24.dfsg+pf.0.1~svn1329/channels/chan_sip.c 2007-08-20 17:57:29.000000000 +0200
@@ -1946,9 +1946,9 @@
struct ast_hostent ahp;
struct sip_peer *p;
int found=0;
- char *port;
+ char *port, *ptr, *hostp, *hostn;
int portno;
- char host[MAXHOSTNAMELEN], *hostn;
+ char host[MAXHOSTNAMELEN];
char peer[256];
ast_copy_string(peer, opeer, sizeof(peer));
@@ -1986,7 +1986,14 @@
portno = tportno;
}
}
- hp = ast_gethostbyname(hostn, &ahp);
+
+ if ((hostp = ast_strdupa(hostn))) {
+ if ((ptr = strchr(hostp, '?')))
+ *ptr = '\0';
+ } else
+ hostp = peer;
+ hp = ast_gethostbyname(hostp, &ahp);
+
if (hp) {
ast_copy_string(dialog->tohost, peer, sizeof(dialog->tohost));
memcpy(&dialog->sa.sin_addr, hp->h_addr, sizeof(dialog->sa.sin_addr));
@@ -5189,6 +5196,7 @@
enum state { NOTIFY_OPEN, NOTIFY_INUSE, NOTIFY_CLOSED } local_state = NOTIFY_OPEN;
char *pidfstate = "--";
char *pidfnote= "Ready";
+ struct sip_pvt *np = NULL;
memset(from, 0, sizeof(from));
memset(to, 0, sizeof(to));
@@ -5303,12 +5311,18 @@
ast_build_string(&t, &maxbytes, "\n", p->exten);
ast_build_string(&t, &maxbytes, "\n", mto);
ast_build_string(&t, &maxbytes, "\n", (local_state == NOTIFY_OPEN) ? "open" : (local_state == NOTIFY_INUSE) ? "inuse" : "closed");
- ast_build_string(&t, &maxbytes, "\n", (local_state == NOTIFY_OPEN) ? "online" : (local_state == NOTIFY_INUSE) ? "onthephone" : "offline");
+ ast_build_string(&t, &maxbytes, "\n",
+ (local_state == NOTIFY_OPEN) ? "online" : (local_state == NOTIFY_INUSE) ? "onthephone" : "offline");
ast_build_string(&t, &maxbytes, "\n\n\n");
break;
case PIDF_XML: /* Eyebeam supports this format */
ast_build_string(&t, &maxbytes, "\n");
- ast_build_string(&t, &maxbytes, "\n", mfrom);
+ ast_build_string(&t, &maxbytes,
+ "\n", mfrom);
ast_build_string(&t, &maxbytes, "\n");
if (pidfstate[0] != '-')
ast_build_string(&t, &maxbytes, "\n", pidfstate);
@@ -5319,17 +5333,53 @@
if (pidfstate[0] == 'b') /* Busy? Still open ... */
ast_build_string(&t, &maxbytes, "open\n");
else
- ast_build_string(&t, &maxbytes, "%s\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
+ ast_build_string(&t, &maxbytes, "%s\n",
+ (local_state != NOTIFY_CLOSED) ? "open" : "closed");
ast_build_string(&t, &maxbytes, "\n\n");
break;
case DIALOG_INFO_XML: /* SNOM subscribes in this format */
ast_build_string(&t, &maxbytes, "\n");
- ast_build_string(&t, &maxbytes, "\n", p->dialogver++, full ? "full":"partial", mto);
- if ((state & AST_EXTENSION_RINGING) && global_notifyringing)
- ast_build_string(&t, &maxbytes, "