[asterisk-commits] branch oej/sipregister r13035 -
/team/oej/sipregister/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Mar 15 07:01:19 MST 2006
Author: oej
Date: Wed Mar 15 08:01:17 2006
New Revision: 13035
URL: http://svn.digium.com/view/asterisk?rev=13035&view=rev
Log:
Small fixes to make it work my way...
Modified:
team/oej/sipregister/channels/chan_sip.c
Modified: team/oej/sipregister/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_sip.c?rev=13035&r1=13034&r2=13035&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_sip.c (original)
+++ team/oej/sipregister/channels/chan_sip.c Wed Mar 15 08:01:17 2006
@@ -3390,13 +3390,18 @@
int portnum = 0;
if (peer) { /* build string from peer info */
- /* XXX authuser ? port ? contact is regexten... */
- snprintf(username, sizeof(username), "%s:%s@%s/%s",
- peer->username, peer->secret, peer->tohost, peer->regexten);
+ /* XXX ? port ? contact is regexten... */
+ if (ast_strlen_zero(peer->fromuser))
+ snprintf(username, sizeof(username), "%s:%s@%s/%s",
+ peer->username, peer->secret, peer->tohost, peer->regexten);
+ else
+ snprintf(username, sizeof(username), "%s:%s:%s@%s/%s",
+ peer->username, peer->secret, peer->fromuser, peer->tohost, peer->regexten);
} else if (value)
ast_copy_string(username, value, sizeof(username));
else
username[0] = '\0';
+
/* First split around the last '@' then parse the two components. */
hostname = strrchr(username, '@'); /* allow @ in the first part */
if (hostname)
@@ -5589,6 +5594,15 @@
}
if (!ast_strlen_zero(r->username))
ast_string_field_set(p, username, r->username);
+
+ /* If we have a peer relationship, fetch some more data from that peer
+ Data that makes sense to use, but is not included in the old
+ register= syntax.
+ */
+ if (r->peer) {
+ if (!ast_strlen_zero(r->peer->fromdomain))
+ ast_string_field_set(p, fromdomain, r->peer->fromdomain);
+ }
/* Save contact in packet */
ast_string_field_set(p, exten, r->contact);
More information about the asterisk-commits
mailing list