aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_sip.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index fad808cc2..3db7f779b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5320,12 +5320,15 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
{
const char *my_name; /* pick a good name */
- if (title)
+ if (title) {
my_name = title;
- else if ( (my_name = strchr(i->fromdomain, ':')) )
- my_name++; /* skip ':' */
- else
- my_name = i->fromdomain;
+ } else {
+ char *port = NULL;
+ my_name = ast_strdupa(i->fromdomain);
+ if ((port = strchr(i->fromdomain, ':'))) {
+ *port = '\0';
+ }
+ }
sip_pvt_unlock(i);
/* Don't hold a sip pvt lock while we allocate a channel */