[Asterisk-code-review] chan sip: Support auth username for callbackextension feature (asterisk[master])

Timo Teräs asteriskteam at digium.com
Fri Jun 3 01:36:25 CDT 2016


Timo Teräs has uploaded a new change for review.

  https://gerrit.asterisk.org/2940

Change subject: chan_sip: Support auth username for callbackextension feature
......................................................................

chan_sip: Support auth username for callbackextension feature

ASTERISK-20527 #close

Change-Id: I659cf7f00836a09d09d146ad226a40477d731239
---
M channels/chan_sip.c
M configs/samples/sip.conf.sample
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/2940/1

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 19f8aa3..03cba92 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -31811,7 +31811,7 @@
 	olddirectmediaacl = ast_free_acl_list(olddirectmediaacl);
 	if (!ast_strlen_zero(peer->callback)) { /* build string from peer info */
 		char *reg_string;
-		if (ast_asprintf(&reg_string, "%s?%s:%s@%s/%s", peer->name, peer->username, !ast_strlen_zero(peer->remotesecret) ? peer->remotesecret : peer->secret, peer->tohost, peer->callback) >= 0) {
+		if (ast_asprintf(&reg_string, "%s?%s:%s:%s@%s/%s", peer->name, S_OR(peer->fromuser, peer->username), S_OR(peer->remotesecret, peer->secret), peer->username, peer->tohost, peer->callback) >= 0) {
 			sip_register(reg_string, 0); /* XXX TODO: count in registry_count */
 			ast_free(reg_string);
 		}
diff --git a/configs/samples/sip.conf.sample b/configs/samples/sip.conf.sample
index 8f28e26..a7b74df 100644
--- a/configs/samples/sip.conf.sample
+++ b/configs/samples/sip.conf.sample
@@ -786,7 +786,7 @@
 ; A similar effect can be achieved by adding a "callbackextension" option in a peer section.
 ; this is equivalent to having the following line in the general section:
 ;
-;        register => username:secret at host/callbackextension
+;        register => fromuser:secret:username at host/callbackextension
 ;
 ; and more readable because you don't have to write the parameters in two places
 ; (note that the "port" is ignored - this is a bug that should be fixed).

-- 
To view, visit https://gerrit.asterisk.org/2940
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I659cf7f00836a09d09d146ad226a40477d731239
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Timo Teräs <timo.teras at iki.fi>



More information about the asterisk-code-review mailing list