[asterisk-commits] rizzo: branch rizzo/astobj2 r76215 - /team/rizzo/astobj2/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 20 16:52:28 CDT 2007
Author: rizzo
Date: Fri Jul 20 16:52:27 2007
New Revision: 76215
URL: http://svn.digium.com/view/asterisk?view=rev&rev=76215
Log:
more diff reduction with trunk. mostly whitespace, but also
some minor bugfixes
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=76215&r1=76214&r2=76215
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Jul 20 16:52:27 2007
@@ -2714,12 +2714,13 @@
\return pointer to terminated stripped string
\param tmp input string that will be modified
Examples:
-
+\verbatim
"foo" <bar> valid input, returns bar
foo returns the whole string
< "foo ... > returns the string between brackets
< "foo... bogus (missing closing bracket), returns the whole string
XXX maybe should still skip the opening bracket
+\endverbatim
*/
static char *get_in_brackets(char *tmp)
{
@@ -2768,7 +2769,9 @@
* Init pointers to empty string so we never get NULL dereferencing.
* Overwrites the string.
* return 0 on success, other values on error.
+\verbatim
* general form we are expecting is sip[s]:username[:password][;parameter]@host[:port][;...]
+\endverbatim
*/
static int parse_uri(char *uri, char *scheme,
char **ret_name, char **pass, char **domain, char **port, char **options)
@@ -2783,7 +2786,7 @@
*port = "";
if (scheme) {
int l = strlen(scheme);
- if (!strncmp(uri, scheme, l))
+ if (!strncasecmp(uri, scheme, l))
uri += l;
else {
ast_log(LOG_NOTICE, "Missing scheme '%s' in '%s'\n", scheme, uri);
@@ -2868,6 +2871,7 @@
time_t nowtime = time(NULL) + expirey;
const char *fc = fullcontact ? "fullcontact" : NULL;
+
int realtimeregs = ast_check_realtime("sipregs");
tablename = realtimeregs ? "sipregs" : "sippeers";
@@ -3480,6 +3484,7 @@
/* Initialize auto-congest time */
p->initid = ast_sched_add(sched, SIP_TRANS_TIMEOUT, auto_congest, pvt_ref(p));
}
+
return res;
}
@@ -3666,9 +3671,10 @@
ast_debug(3, "Updating call counter for %s call\n", outgoing ? "outgoing" : "incoming");
+
/* Test if we need to check call limits, in order to avoid
realtime lookups if we do not need it */
- if (!ast_test_flag(&fup->flags[0], SIP_CALL_LIMIT))
+ if (!ast_test_flag(&fup->flags[0], SIP_CALL_LIMIT) && !ast_test_flag(&fup->flags[1], SIP_PAGE2_CALL_ONHOLD))
return 0;
ast_copy_string(name, fup->username, sizeof(name));
@@ -3706,7 +3712,8 @@
/* Decrement onhold count if applicable */
if (ast_test_flag(&fup->flags[1], SIP_PAGE2_CALL_ONHOLD) && global_notifyhold)
sip_peer_hold(fup, FALSE);
- ast_debug(2, "Call %s %s '%s' removed from call limit %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *call_limit);
+ if (sipdebug)
+ ast_debug(2, "Call %s %s '%s' removed from call limit %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *call_limit);
break;
case INC_CALL_RINGING:
@@ -3929,7 +3936,7 @@
}
if (ast_test_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER)) {
- if (ast_test_flag(&p->flags[0], SIP_INC_COUNT)) {
+ if (ast_test_flag(&p->flags[0], SIP_INC_COUNT) || ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) {
if (sipdebug)
ast_debug(1, "update_call_counter(%s) - decrement call limit counter on hangup\n", p->username);
update_call_counter(p, DEC_CALL_LIMIT);
@@ -3948,11 +3955,12 @@
ast_debug(1, "SIP Transfer: Hanging up Zombie channel %s after transfer ... Call-ID: %s\n", ast->name, p->callid);
else
ast_debug(1, "Hangup call %s, SIP callid %s)\n", ast->name, p->callid);
+
if (ast_test_flag(ast, AST_FLAG_ZOMBIE))
ast_debug(1, "Hanging up zombie call. Be scared.\n");
sip_pvt_lock(p);
- if (ast_test_flag(&p->flags[0], SIP_INC_COUNT)) {
+ if (ast_test_flag(&p->flags[0], SIP_INC_COUNT) || ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) {
if (sipdebug)
ast_debug(1, "update_call_counter(%s) - decrement call limit counter on hangup\n", p->username);
update_call_counter(p, DEC_CALL_LIMIT);
@@ -3964,6 +3972,7 @@
sip_pvt_unlock(p);
return 0;
}
+ /* If the call is not UP, we need to send CANCEL instead of BYE */
/* In case of re-invites, the call might be UP even though we have an incomplete invite transaction */
if (p->invitestate < INV_COMPLETED && p->owner->_state != AST_STATE_UP) {
needcancel = TRUE;
@@ -4536,6 +4545,7 @@
ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
+
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */
tmp->cid.cid_num = ast_strdup(i->cid_num);
@@ -4556,15 +4566,17 @@
pbx_builtin_setvar_helper(tmp, "SIPCALLID", i->callid);
if (i->rtp)
ast_jb_configure(tmp, &global_jbconf);
+
+ /* Set channel variables for this call from configuration */
+ for (v = i->chanvars ; v ; v = v->next)
+ pbx_builtin_setvar_helper(tmp,v->name,v->value);
+
if (state != AST_STATE_DOWN && ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
tmp->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
ast_hangup(tmp);
tmp = NULL;
}
- /* Set channel variables for this call from configuration */
- for (v = i->chanvars ; v ; v = v->next)
- pbx_builtin_setvar_helper(tmp,v->name,v->value);
append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);
More information about the asterisk-commits
mailing list