[svn-commits] oej: branch oej/register-call-dependency-1.8 r422111 - in /team/oej/register-...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Aug 27 04:37:20 CDT 2014
Author: oej
Date: Wed Aug 27 04:37:13 2014
New Revision: 422111
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=422111
Log:
Hmm. Did I say "dirty" ?
Modified:
team/oej/register-call-dependency-1.8/channels/chan_sip.c
team/oej/register-call-dependency-1.8/channels/sip/include/sip.h
Modified: team/oej/register-call-dependency-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/register-call-dependency-1.8/channels/chan_sip.c?view=diff&rev=422111&r1=422110&r2=422111
==============================================================================
--- team/oej/register-call-dependency-1.8/channels/chan_sip.c (original)
+++ team/oej/register-call-dependency-1.8/channels/chan_sip.c Wed Aug 27 04:37:13 2014
@@ -13706,13 +13706,27 @@
* end up using an outbound proxy. obproxy_get is safe to call with either of r->call
* or peer NULL. Since we're only concerned with its existence, we're not going to
* bother getting a ref to the proxy*/
- if (!obproxy_get(r->call, peer)) {
+ /* If we need to register before call, we disregard the outbound proxy setting */
+ if (ast_test_flag(&peer->flags[2], SIP_PAGE3_REG_BEFORE_CALL) ||Â !obproxy_get(r->call, peer)) {
registry_addref(r, "add reg ref for dnsmgr");
ast_dnsmgr_lookup_cb(peer ? peer->tohost : r->hostname, &r->us, &r->dnsmgr, sip_cfg.srvlookup ? transport : NULL, on_dns_update_registry, r);
if (!r->dnsmgr) {
/*dnsmgr refresh disabled, no reference added! */
registry_unref(r, "remove reg ref, dnsmgr disabled");
}
+ }
+ if (ast_test_flag(&peer->flags[2], SIP_PAGE3_REG_BEFORE_CALL)) {
+ /* Make an outbound proxy config string */
+ snprintf(transport, sizeof(transport), "%s://%s:%d", get_srv_protocol(r->transport), ast_sockaddr_stringify_remote(&r->us), r->portno);
+ ast_debug(" ==> Setting outbound proxy based on reg for peer %s to %s\n", peer->name, transport);
+ /* We need to set the IP we register to as the outbound proxy SKREP
+ */
+ /* If there's a configured outbound proxy, just remove it */
+ if (peer->outboundproxy) {
+ ao2_ref(peer->outboundproxy, -1);
+ }
+
+ peer->outboundproxy = proxy_from_config(transport, 0, NULL);
}
if (peer) {
peer = unref_peer(peer, "removing peer ref for dnsmgr_lookup");
@@ -27589,6 +27603,9 @@
} else if (!strcasecmp(v->name, "useclientcode")) {
ast_set_flag(&mask[0], SIP_USECLIENTCODE);
ast_set2_flag(&flags[0], ast_true(v->value), SIP_USECLIENTCODE);
+ } else if (!strcasecmp(v->name, "regbeforecall")) {
+ ast_set_flag(&mask[2], SIP_PAGE3_REG_BEFORE_CALL);
+ ast_set2_flag(&flags[2], ast_true(v->value), SIP_PAGE3_REG_BEFORE_CALL);
} else if (!strcasecmp(v->name, "dtmfmode")) {
ast_set_flag(&mask[0], SIP_DTMF);
ast_clear_flag(&flags[0], SIP_DTMF);
@@ -28946,6 +28963,7 @@
sip_cfg.rtautoclear = 120;
ast_set_flag(&global_flags[1], SIP_PAGE2_ALLOWSUBSCRIBE); /* Default for all devices: TRUE */
ast_set_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP_YES); /* Default for all devices: Yes */
+ ast_set_flag(&global_flags[2], DEFAULT_REG_BEFORE_CALL); /* Default for all devices: No */
sip_cfg.peer_rtupdate = TRUE;
global_dynamic_exclude_static = 0; /* Exclude static peers */
sip_cfg.tcp_enabled = FALSE;
Modified: team/oej/register-call-dependency-1.8/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/register-call-dependency-1.8/channels/sip/include/sip.h?view=diff&rev=422111&r1=422110&r2=422111
==============================================================================
--- team/oej/register-call-dependency-1.8/channels/sip/include/sip.h (original)
+++ team/oej/register-call-dependency-1.8/channels/sip/include/sip.h Wed Aug 27 04:37:13 2014
@@ -58,6 +58,7 @@
#define DEFAULT_MWI_EXPIRY 3600
#define DEFAULT_REGISTRATION_TIMEOUT 20
#define DEFAULT_MAX_FORWARDS 70
+#define DEFAULT_REG_BEFORE_CALL FALSE
#define DEFAULT_AUTHLIMIT 100
#define DEFAULT_AUTHTIMEOUT 30
@@ -364,9 +365,10 @@
#define SIP_PAGE3_SNOM_AOC (1 << 0) /*!< DPG: Allow snom aoc messages */
#define SIP_PAGE3_DIRECT_MEDIA_OUTGOING (1 << 1) /*!< DP: Only send direct media reinvites on outgoing calls */
+#define SIP_PAGE3_REG_BEFORE_CALL (1 << 2) /*!< PG: Only call peers we're registred with */
#define SIP_PAGE3_FLAGS_TO_COPY \
- (SIP_PAGE3_SNOM_AOC | SIP_PAGE3_DIRECT_MEDIA_OUTGOING)
+ (SIP_PAGE3_SNOM_AOC | SIP_PAGE3_DIRECT_MEDIA_OUTGOING | SIP_PAGE3_REG_BEFORE_CALL)
/*@}*/
More information about the svn-commits
mailing list