summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2006-10-07 12:50:42 +0000
committerLuigi Rizzo <rizzo@icir.org>2006-10-07 12:50:42 +0000
commit901a66c40106872b6ee10c851070a90947518de0 (patch)
tree44d6daece3f8bec4dc444a7232e94283d8c1959e
parenta1a5824869eb04ed7973ff9c6797282d7d436df5 (diff)
slightly restructure the code that computes the channel's name
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 62e9d7b6e..316c26f1a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3716,12 +3716,16 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
}
- if (title)
- ast_string_field_build(tmp, name, "SIP/%s-%08x", title, (int)(long) i);
- else if (strchr(i->fromdomain,':'))
- ast_string_field_build(tmp, name, "SIP/%s-%08x", strchr(i->fromdomain,':') + 1, (int)(long) i);
- else
- ast_string_field_build(tmp, name, "SIP/%s-%08x", i->fromdomain, (int)(long) i);
+ {
+ const char *my_name; /* pick a good name */
+ if (title)
+ my_name = title;
+ else if ( (my_name = strchr(i->fromdomain,':')) )
+ my_name++; /* skip ':' */
+ else
+ my_name = i->fromdomain;
+ ast_string_field_build(tmp, name, "SIP/%s-%08x", my_name, (int)(long) i);
+ }
if (ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INBAND) {
i->vad = ast_dsp_new();