Review Board 1.7.16


cleanup dialog-info+xml Notify dialog

Review Request #1693 - Created Jan. 25, 2012 and submitted

Alec Davis
Asterisk 1.8 and above
Reviewers
asterisk-dev
Asterisk
Make consistant with the other dialog types, (and more human readable)
Simply added "\n" in 3 places

Sip debug previously looked like;

<?xml version="1.0"?><dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="715" state="full" entity="sip:8523@192.168.x.xx"><dialog id="8523">
<state>terminated</state>
</dialog>
</dialog-info>

Sip debug now looks like below;

User-Agent: Asterisk PBX 1.8.8.2
Subscription-State: active
Event: dialog
Content-Type: application/dialog-info+xml
Content-Length: 207

<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="715" state="full" entity="sip:8523@192.168.x.xx">
<dialog id="8523">
<state>terminated</state>
</dialog>
</dialog-info>
on a box with 116 registered hints.

Diff revision 2 (Latest)

1 2
1 2

  1. trunk/channels/chan_sip.c: Loading...
trunk/channels/chan_sip.c
Revision 351705 New Change
[20] 12802 lines
[+20] [+] static void state_notify_build_xml(int state, int full, const char *exten, const char *context, struct ast_str **tmp, struct sip_pvt *p, int subscribed, const char *mfrom, const char *mto)
12803
		else
12803
		else
12804
			ast_str_append(tmp, 0, "<status><basic>%s</basic></status>\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
12804
			ast_str_append(tmp, 0, "<status><basic>%s</basic></status>\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
12805
		ast_str_append(tmp, 0, "</tuple>\n</presence>\n");
12805
		ast_str_append(tmp, 0, "</tuple>\n</presence>\n");
12806
		break;
12806
		break;
12807
	case DIALOG_INFO_XML: /* SNOM subscribes in this format */
12807
	case DIALOG_INFO_XML: /* SNOM subscribes in this format */
12808
		ast_str_append(tmp, 0, "<?xml version=\"1.0\"?>");
12808
		ast_str_append(tmp, 0, "<?xml version=\"1.0\"?>\n");
12809
		ast_str_append(tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">", p->dialogver, full ? "full" : "partial", mto);
12809
		ast_str_append(tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver, full ? "full" : "partial", mto);
12810
		if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
12810
		if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
12811
			const char *local_display = exten;
12811
			const char *local_display = exten;
12812
			char *local_target = ast_strdupa(mto);
12812
			char *local_target = ast_strdupa(mto);
12813

    
   
12813

   
12814
			/* There are some limitations to how this works.  The primary one is that the
12814
			/* There are some limitations to how this works.  The primary one is that the
[+20] [20] 42 lines
[+20] static void state_notify_build_xml(int state, int full, const char *exten, const char *context, struct ast_str **tmp, struct sip_pvt *p, int subscribed, const char *mfrom, const char *mto)
12857
			} else {
12857
			} else {
12858
				ast_str_append(tmp, 0, "<dialog id=\"%s\" direction=\"recipient\">\n", exten);
12858
				ast_str_append(tmp, 0, "<dialog id=\"%s\" direction=\"recipient\">\n", exten);
12859
			}
12859
			}
12860

    
   
12860

   
12861
		} else {
12861
		} else {
12862
			ast_str_append(tmp, 0, "<dialog id=\"%s\">", exten);
12862
			ast_str_append(tmp, 0, "<dialog id=\"%s\">\n", exten);
12863
		}
12863
		}
12864
		ast_str_append(tmp, 0, "<state>%s</state>\n", statestring);
12864
		ast_str_append(tmp, 0, "<state>%s</state>\n", statestring);
12865
		if (state == AST_EXTENSION_ONHOLD) {
12865
		if (state == AST_EXTENSION_ONHOLD) {
12866
				ast_str_append(tmp, 0, "<local>\n<target uri=\"%s\">\n"
12866
				ast_str_append(tmp, 0, "<local>\n<target uri=\"%s\">\n"
12867
			                                    "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n"
12867
			                                    "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n"
[+20] [20] 18435 lines
  1. trunk/channels/chan_sip.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.