aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-01 17:41:56 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-01 17:41:56 +0000
commit6f8babe41a8e997f0fd87d00f825eb1ac3047d8d (patch)
tree4a38365b1a93e0e9cba77bbcd00cee5e3a39ca05 /channels
parent260b85dbbc8de8357490cc0e26eb73f09f210943 (diff)
- Backport of the "limitonpeers" patch from trunk, to fix a lot of issues with queues and SIP device states
- Remove support for T.38 early media, since it's impossible. (Two patches in one - extra friday evening offer due to being off line from svn today... :-) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@48177 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 921f92ff7..6b3be234c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -513,6 +513,7 @@ static int default_maxcallbitrate; /*!< Maximum bitrate for call */
static struct ast_codec_pref default_prefs; /*!< Default codec prefs */
/* Global settings only apply to the channel */
+static int global_limitonpeers; /*!< Match call limit on peers only */
static int global_rtautoclear;
static int global_notifyringing; /*!< Send notifications on ringing */
static int global_notifyhold; /*!< Send notifications on hold */
@@ -2944,7 +2945,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
static int update_call_counter(struct sip_pvt *fup, int event)
{
char name[256];
- int *inuse, *call_limit, *inringing;
+ int *inuse = NULL, *call_limit = NULL, *inringing = NULL;
int outgoing = ast_test_flag(&fup->flags[0], SIP_OUTGOING);
struct sip_user *u = NULL;
struct sip_peer *p = NULL;
@@ -2959,16 +2960,17 @@ static int update_call_counter(struct sip_pvt *fup, int event)
ast_copy_string(name, fup->username, sizeof(name));
/* Check the list of users only for incoming calls */
- if (!outgoing && (u = find_user(name, 1)) ) {
+ if (global_limitonpeers == FALSE && !outgoing && (u = find_user(name, 1))) {
inuse = &u->inUse;
call_limit = &u->call_limit;
inringing = NULL;
- } else if ( (p = find_peer(fup->peername, NULL, 1) ) ) { /* Try to find peer */
+ } else if ( (p = find_peer(ast_strlen_zero(fup->peername) ? name : fup->peername, NULL, 1) ) ) { /* Try to find peer */
inuse = &p->inUse;
call_limit = &p->call_limit;
inringing = &p->inRinging;
ast_copy_string(name, fup->peername, sizeof(name));
- } else {
+ }
+ if (!p && !u) {
if (option_debug > 1)
ast_log(LOG_DEBUG, "%s is not a local device, no call limit\n", name);
return 0;
@@ -3469,15 +3471,12 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
case AST_FRAME_MODEM:
if (p) {
ast_mutex_lock(&p->lock);
- if (p->udptl) {
- if ((ast->_state != AST_STATE_UP) &&
- !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
- !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
- transmit_response_with_t38_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
- ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
- }
+ /* UDPTL requires two-way communication, so early media is not needed here.
+ we simply forget the frames if we get modem frames before the bridge is up.
+ Fax will re-transmit.
+ */
+ if (p->udptl && ast->_state != AST_STATE_UP)
res = ast_udptl_write(p->udptl, frame);
- }
ast_mutex_unlock(&p->lock);
}
break;
@@ -10155,6 +10154,7 @@ static int sip_show_settings(int fd, int argc, char *argv[])
ast_cli(fd, " Our auth realm %s\n", global_realm);
ast_cli(fd, " Realm. auth: %s\n", authl ? "Yes": "No");
ast_cli(fd, " Always auth rejects: %s\n", global_alwaysauthreject ? "Yes" : "No");
+ ast_cli(fd, " Call limit peers only: %s\n", global_limitonpeers ? "Yes" : "No");
ast_cli(fd, " User Agent: %s\n", global_useragent);
ast_cli(fd, " MWI checking interval: %d secs\n", global_mwitime);
ast_cli(fd, " Reg. context: %s\n", S_OR(global_regcontext, "(not set)"));
@@ -15892,6 +15892,7 @@ static int reload_config(enum channelreloadreason reason)
global_regcontext[0] = '\0';
expiry = DEFAULT_EXPIRY;
global_notifyringing = DEFAULT_NOTIFYRINGING;
+ global_limitonpeers = FALSE;
global_notifyhold = FALSE;
global_alwaysauthreject = 0;
global_allowsubscribe = FALSE;
@@ -16014,6 +16015,8 @@ static int reload_config(enum channelreloadreason reason)
compactheaders = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifymimetype")) {
ast_copy_string(default_notifymime, v->value, sizeof(default_notifymime));
+ } else if (!strcasecmp(v->name, "limitonpeers")) {
+ global_limitonpeers = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifyringing")) {
global_notifyringing = ast_true(v->value);
} else if (!strcasecmp(v->name, "notifyhold")) {