[svn-commits] mmichelson: branch group/CCSS r230213 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 13 16:35:12 CST 2009


Author: mmichelson
Date: Fri Nov 13 16:35:08 2009
New Revision: 230213

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230213
Log:
Fill in transmit_publish a bit.

The meat is there. I'll probably need to add parameters (or add fields
to the sip_epa_entry struct) so that I can properly allocate a sip_pvt
and direct it to the proper destination.


Modified:
    team/group/CCSS/channels/chan_sip.c

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=230213&r1=230212&r2=230213
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Fri Nov 13 16:35:08 2009
@@ -11711,9 +11711,37 @@
 	add_header(req, "Diversion", header_text);
 }
 
-static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type)
-{
-	/*XXX STUB */
+static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * const body)
+{
+	struct sip_pvt *pvt;
+	struct sip_request req;
+	char expires_str[10];
+
+	/* XXX Use sip_alloc and create_addr here */
+
+	req.method = SIP_PUBLISH;
+
+	pvt->branch = ast_random();
+	build_via(p);
+
+	initreqprep(&req, p, SIP_PUBLISH);
+
+	if (p->options && p->options->auth) {
+		add_header(&req, p->options->authheader, p->options->auth);
+	}
+
+	add_header("Event", epa_entry->event);
+
+	snprintf(expires_str, sizeof(expires_str), "%d", publish_type == SIP_PUBLISH_REMOVE ? 0 : DEFAULT_PUBLISH_EXPIRES);
+	add_header("Expires", expires_str);
+
+	if (publish_type != SIP_PUBLISH_INITIAL) {
+		add_header("SIP-If-Match", epa_entry->entity_tag);
+	}
+
+	add_line(&req, body);
+	send_request(p, &req, XMIT_RELIABLE, INITIAL_CSEQ);
+
 	return 0;
 }
 




More information about the svn-commits mailing list