[asterisk-commits] rizzo: branch rizzo/astobj2 r47940 -
/team/rizzo/astobj2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Nov 22 11:54:08 MST 2006
Author: rizzo
Date: Wed Nov 22 12:54:08 2006
New Revision: 47940
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47940
Log:
a bit more documentation on the state handling for responses.
Modified:
team/rizzo/astobj2/channels/chan_sip.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47940&r1=47939&r2=47940
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Wed Nov 22 12:54:08 2006
@@ -12598,19 +12598,31 @@
if (resp != 100)
handle_response_peerpoke(p, resp, req);
} else if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
+
+ /* XXX i wonder if we could do the switch() on sipmethod instead */
+/* The matrix is the following, where x means a handler, * special code.
+
+ INVITE MESSAGE NOTIFY REG. BYE REFER owner
+ 100 x
+ 180 x
+ 183 x
+ 200 x * * x *
+ 202 x
+ 401 x x x
+ 403 x x
+ 404 x x *
+ 407 x x * x
+ ...to be completed
+ */
+
switch(resp) {
case 100: /* 100 Trying */
- if (sipmethod == SIP_INVITE)
- handle_response_invite(p, resp, rest, req, seqno);
- break;
case 183: /* 183 Session Progress */
- if (sipmethod == SIP_INVITE)
- handle_response_invite(p, resp, rest, req, seqno);
- break;
case 180: /* 180 Ringing */
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
break;
+
case 200: /* 200 OK */
p->authtries = 0; /* Reset authentication counter */
if (sipmethod == SIP_MESSAGE) {
@@ -14967,7 +14979,6 @@
int len;
int res = 0;
int debug = sip_debug_test_pvt(p);
- int error = 0;
char *e = req->rlPart2;
/* Get Method and Cseq */
@@ -14975,13 +14986,12 @@
/* Must have Cseq */
if (ast_strlen_zero(req->header[0]) || ast_strlen_zero(cseq)) {
ast_log(LOG_ERROR, "Missing Cseq. Dropping this SIP message, it's incomplete.\n");
- error = 1;
- }
- if (!error && sscanf(cseq, "%d%n", &seqno, &len) != 1) {
+ res = 1;
+ } else if (sscanf(cseq, "%d%n", &seqno, &len) != 1) {
ast_log(LOG_ERROR, "No seqno in '%s'. Dropping incomplete message.\n", req->header[0]);
- error = 1;
- }
- if (error) {
+ res = 1;
+ }
+ if (res) {
if (!p->initreq.header) /* New call */
set_destroy(p); /* Make sure we destroy this dialog */
return -1;
More information about the asterisk-commits
mailing list