[asterisk-commits] file: branch file/pimp_sip_location r381325 - in /team/file/pimp_sip_location...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Feb 12 15:32:06 CST 2013
Author: file
Date: Tue Feb 12 15:32:03 2013
New Revision: 381325
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381325
Log:
Add support for specifying an outbound proxy on an endpoint or location basis.
Modified:
team/file/pimp_sip_location/include/asterisk/res_sip.h
team/file/pimp_sip_location/res/res_sip.c
team/file/pimp_sip_location/res/res_sip/location.c
team/file/pimp_sip_location/res/res_sip/sip_configuration.c
Modified: team/file/pimp_sip_location/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/include/asterisk/res_sip.h?view=diff&rev=381325&r1=381324&r2=381325
==============================================================================
--- team/file/pimp_sip_location/include/asterisk/res_sip.h (original)
+++ team/file/pimp_sip_location/include/asterisk/res_sip.h Tue Feb 12 15:32:03 2013
@@ -123,6 +123,8 @@
AST_STRING_FIELD(uri);
/*! Optional explicit transport to use */
AST_STRING_FIELD(transport);
+ /*! Outbound proxy to use */
+ AST_STRING_FIELD(outbound_proxy);
);
/*! Whether the user portion of the request URI is permitted to be changed or not */
unsigned int change_user;
@@ -169,8 +171,10 @@
AST_DECLARE_STRING_FIELDS(
/*! Context to send incoming calls to */
AST_STRING_FIELD(context);
- /*! Name of an explicit transport to use */
- AST_STRING_FIELD(transport);
+ /*! Name of an explicit transport to use */
+ AST_STRING_FIELD(transport);
+ /*! Outbound proxy to use */
+ AST_STRING_FIELD(outbound_proxy);
);
/*! Identification information for this endpoint */
struct ast_party_id id;
Modified: team/file/pimp_sip_location/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip.c?view=diff&rev=381325&r1=381324&r2=381325
==============================================================================
--- team/file/pimp_sip_location/res/res_sip.c (original)
+++ team/file/pimp_sip_location/res/res_sip.c Tue Feb 12 15:32:03 2013
@@ -296,7 +296,7 @@
pj_str_t local_uri = pj_str("sip:temp at localhost"), remote_uri;
RAII_VAR(struct ast_sip_location *, location, NULL, ao2_cleanup);
pjsip_dialog *dlg = NULL;
- const char *transport_name = endpoint->transport;
+ const char *transport_name = endpoint->transport, *outbound_proxy = endpoint->outbound_proxy;
pjsip_tpselector selector = { .type = PJSIP_TPSELECTOR_NONE, };
const pj_str_t HCONTACT = { "Contact", 7 };
@@ -304,6 +304,9 @@
pj_cstr(&remote_uri, location->uri);
if (!ast_strlen_zero(location->transport)) {
transport_name = location->transport;
+ }
+ if (!ast_strlen_zero(location->outbound_proxy)) {
+ outbound_proxy = location->outbound_proxy;
}
} else {
pj_cstr(&remote_uri, location_name);
@@ -354,6 +357,23 @@
dlg->sess_count++;
pjsip_dlg_set_transport(dlg, &selector);
+
+ if (!ast_strlen_zero(outbound_proxy)) {
+ pjsip_route_hdr route_set, *route;
+ static const pj_str_t ROUTE_HNAME = { "Route", 5 };
+ pj_str_t tmp;
+
+ pj_list_init(&route_set);
+
+ pj_strdup2_with_null(dlg->pool, &tmp, outbound_proxy);
+ if (!(route = pjsip_parse_hdr(dlg->pool, &ROUTE_HNAME, tmp.ptr, tmp.slen, NULL))) {
+ pjsip_dlg_terminate(dlg);
+ return NULL;
+ }
+ pj_list_push_back(&route_set, route);
+
+ pjsip_dlg_set_route_set(dlg, &route_set);
+ }
dlg->sess_count--;
Modified: team/file/pimp_sip_location/res/res_sip/location.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip/location.c?view=diff&rev=381325&r1=381324&r2=381325
==============================================================================
--- team/file/pimp_sip_location/res/res_sip/location.c (original)
+++ team/file/pimp_sip_location/res/res_sip/location.c Tue Feb 12 15:32:03 2013
@@ -64,6 +64,7 @@
ast_sorcery_object_field_register(sorcery, "location", "type", "", OPT_NOOP_T, 0, 0);
ast_sorcery_object_field_register(sorcery, "location", "uri", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_location, uri));
ast_sorcery_object_field_register(sorcery, "location", "transport", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_location, transport));
+ ast_sorcery_object_field_register(sorcery, "location", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_location, outbound_proxy));
ast_sorcery_object_field_register(sorcery, "location", "change_user", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_location, change_user));
return 0;
Modified: team/file/pimp_sip_location/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip/sip_configuration.c?view=diff&rev=381325&r1=381324&r2=381325
==============================================================================
--- team/file/pimp_sip_location/res/res_sip/sip_configuration.c (original)
+++ team/file/pimp_sip_location/res/res_sip/sip_configuration.c Tue Feb 12 15:32:03 2013
@@ -145,6 +145,7 @@
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "qualify_frequency", 0, OPT_UINT_T, PARSE_IN_RANGE, FLDSET(struct ast_sip_endpoint, qualify_frequency), 0, 86400);
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtmfmode", "rfc4733", dtmf_handler, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "transport", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, transport));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, outbound_proxy));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "100rel", "yes", prack_handler, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "timers", "yes", timers_handler, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "timers_min_se", "90", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, min_se));
More information about the asterisk-commits
mailing list