[asterisk-commits] mmichelson: branch group/CCSS r238752 - /team/group/CCSS/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 8 15:27:46 CST 2010
Author: mmichelson
Date: Fri Jan 8 15:27:42 2010
New Revision: 238752
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=238752
Log:
* Change the CSeq given to send_request in transmit_publish
* Change the body of the PUBLISH to be a component of the sip_epa_entry. This
allows us to easily transmit the same PUBLISH a second time if we have to
authenticate with the ESC we send the PUBLISH to. More changes are coming
to address the authentication issue.
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=238752&r1=238751&r2=238752
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Fri Jan 8 15:27:42 2010
@@ -1833,6 +1833,12 @@
* or a hostname.
*/
char destination[SIPBUFSIZE];
+ /* The body of the most recently-sent PUBLISH message.
+ * This is useful for situations such as authentication,
+ * in which we must send a message identical to the
+ * one previously sent
+ */
+ char body[SIPBUFSIZE];
/* Every event package has some constant data and
* callbacks that all instances will share. This
* data resides in this field.
@@ -2974,7 +2980,7 @@
static void transmit_fake_auth_response(struct sip_pvt *p, int sipmethod, struct sip_request *req, enum xmittype reliable);
static int transmit_request(struct sip_pvt *p, int sipmethod, int inc, enum xmittype reliable, int newbranch);
static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch);
-static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * body, const char * const explicit_uri);
+static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * const explicit_uri);
static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init, const char * const explicit_uri);
static int transmit_reinvite_with_sdp(struct sip_pvt *p, int t38version, int oldsdp);
static int transmit_info_with_digit(struct sip_pvt *p, const char digit, unsigned int duration);
@@ -3733,7 +3739,6 @@
{
struct sip_monitor_instance *monitor_instance = find_sip_monitor_instance(core_id);
enum sip_publish_type publish_type;
- char pidf_body[256];
if (!monitor_instance) {
return -1;
@@ -3751,8 +3756,8 @@
publish_type = SIP_PUBLISH_MODIFY;
}
- construct_pidf_body(CC_CLOSED, pidf_body, sizeof(pidf_body));
- transmit_publish(monitor_instance->suspension_entry, publish_type, pidf_body, monitor_instance->notify_uri);
+ construct_pidf_body(CC_CLOSED, monitor_instance->suspension_entry->body, sizeof(monitor_instance->suspension_entry->body));
+ transmit_publish(monitor_instance->suspension_entry, publish_type, monitor_instance->notify_uri);
ao2_ref(monitor_instance, -1);
return 0;
@@ -3778,7 +3783,7 @@
ast_assert(monitor_instance->suspension_entry != NULL);
construct_pidf_body(CC_OPEN, pidf_body, sizeof(pidf_body));
- transmit_publish(monitor_instance->suspension_entry, SIP_PUBLISH_MODIFY, pidf_body, monitor_instance->notify_uri);
+ transmit_publish(monitor_instance->suspension_entry, SIP_PUBLISH_MODIFY, monitor_instance->notify_uri);
ao2_ref(monitor_instance, -1);
return 0;
@@ -8770,6 +8775,7 @@
sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find in dialogs");
if (sip_pvt_ptr) { /* well, if we don't find it-- what IS in there? */
/* Found the call */
+ ast_log(LOG_NOTICE, "Found match %p whose method is %s\n", sip_pvt_ptr, sip_methods[sip_pvt_ptr->method].text);
sip_pvt_lock(sip_pvt_ptr);
return sip_pvt_ptr;
}
@@ -12476,7 +12482,7 @@
add_header(req, "Diversion", header_text);
}
-static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * const body, const char * const explicit_uri)
+static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * const explicit_uri)
{
struct sip_pvt *pvt;
struct sip_request req;
@@ -12514,14 +12520,14 @@
}
if (publish_type == SIP_PUBLISH_INITIAL || publish_type == SIP_PUBLISH_MODIFY) {
- add_line(&req, body);
+ add_line(&req, epa_entry->body);
}
/* Bump refcount for sip_pvt's reference */
ao2_ref(epa_entry, +1);
pvt->epa_entry = epa_entry;
- send_request(pvt, &req, XMIT_RELIABLE, INITIAL_CSEQ);
+ send_request(pvt, &req, XMIT_RELIABLE, pvt->ocseq);
sip_pvt_unlock(pvt);
dialog_unref(pvt, "Done with the sip_pvt allocated for transmitting PUBLISH");
@@ -19754,7 +19760,7 @@
if (p->options) {
p->options->auth_type = (resp == 401 ? WWW_AUTH : PROXY_AUTH);
}
- if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, resp, SIP_PUBLISH, 1)) {
+ if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, resp, SIP_PUBLISH, 0)) {
ast_log(LOG_NOTICE, "Failed to authenticate on PUBLISH to '%s'\n", get_header(&p->initreq, "From"));
}
}
More information about the asterisk-commits
mailing list