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 */
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;
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;
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;
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)"));
global_regcontext[0] = '\0';
expiry = DEFAULT_EXPIRY;
global_notifyringing = DEFAULT_NOTIFYRINGING;
+ global_limitonpeers = FALSE;
global_notifyhold = FALSE;
global_alwaysauthreject = 0;
global_allowsubscribe = FALSE;
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")) {