[Asterisk-cvs] asterisk/channels chan_sip.c,1.195,1.196
martinp at lists.digium.com
martinp at lists.digium.com
Wed Oct 15 16:46:03 CDT 2003
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv27954/channels
Modified Files:
chan_sip.c
Log Message:
In the SIP -> SIP if the called party disconnects with 486 make sure that the calling party gets 486 also
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- chan_sip.c 15 Oct 2003 17:32:19 -0000 1.195
+++ chan_sip.c 15 Oct 2003 22:12:05 -0000 1.196
@@ -1010,6 +1010,31 @@
static int transmit_response_reliable(struct sip_pvt *p, char *msg, struct sip_request *req);
+static int hangup_sip2cause(int cause)
+{
+ switch(cause)
+ {
+ case 486:
+ return AST_CAUSE_BUSY;
+ default:
+ return AST_CAUSE_NORMAL;
+ }
+ /* Never reached */
+ return 0;
+}
+
+static char *hangup_cause2sip(int cause)
+{
+ switch(cause)
+ {
+ case AST_CAUSE_BUSY:
+ return "486 Busy";
+ default:
+ return NULL;
+ }
+ /* Never reached */
+ return 0;
+}
static int sip_hangup(struct ast_channel *ast)
{
@@ -1061,8 +1086,13 @@
INVITE, but do set an autodestruct just in case. */
needdestroy = 0;
sip_scheddestroy(p, 15000);
- } else
- transmit_response_reliable(p, "403 Forbidden", &p->initreq);
+ } else {
+ char *res;
+ if (ast->hangupcause && ((res = hangup_cause2sip(ast->hangupcause)))) {
+ transmit_response_reliable(p, res, &p->initreq);
+ } else
+ transmit_response_reliable(p, "403 Forbidden", &p->initreq);
+ }
} else {
if (!p->pendinginvite) {
/* Send a hangup */
@@ -4456,19 +4486,6 @@
ast_log(LOG_DEBUG, "Found 302 Redirect to extension '%s'\n", s);
if (p->owner)
strncpy(p->owner->call_forward, s, sizeof(p->owner->call_forward) - 1);
-}
-
-static int hangup_sip2cause(int cause)
-{
- switch(cause)
- {
- case 486:
- return AST_CAUSE_BUSY;
- default:
- return AST_CAUSE_NORMAL;
- }
- /* Never reached */
- return 0;
}
static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req)
More information about the svn-commits
mailing list