[Asterisk-Users] Setting channel display in SIP

Howard Lowndes lannet at lannet.com.au
Wed Jan 12 19:12:07 MST 2005


On Thu, 2005-01-13 at 12:38, Adam Goryachev wrote:
> On Thu, 2005-01-13 at 11:24 +1100, Howard Lowndes wrote:
> > On Thu, 2005-01-13 at 11:11, Adam Goryachev wrote:
> > > On Thu, 2005-01-13 at 10:20 +1100, Howard Lowndes wrote:
> > > > I have a situation where I need to know which Zap channel an incoming
> > > > call is on, so that the call can be answered appropriately when a SIP
> > > > phone displays the channel.  These Zap calls are coming in over PSTN and
> > > > don't have caller ID.
> > > > 
> > > > As far as I can make out my SIP phones (WuChuan HOP-1002) display the
> > > > user part from the SIP "From:" header as the second line on the
> > > > display.  If the call comes from another SIP phone then this shows as
> > > > the phone's number, but when the call comes in over the Zap channels
> > > > then it gets generated as "asterisk".
> > > 
> > > AFAIK, this is the default callerid asterisk uses when it doesn't
> > > receive callerid.
> > > Try adding setcallerid in your dialplan,
> > 
> > I tried setcidname in the dialplan without success, so I will try this
> > suggestion.
> 
> Play with combinations of setcallerid and setcidnum and setcidname ...
> see the wiki to correctly format your examples.

I have actually got a bit more cunning that this by using sipgetheader()
and sipaddheader().

The default user name is "asterisk", hard coded in chan_sip.c, so what I
did was to use sipgetheader() to get the From: header, then I cut() it
at the ":" character and the "@" character and checked the string
between these two characters.  If the string was "asterisk" then I did
sipaddheader(From: ${PIECE_BEFORE}:replacement-string@${PIECE_AFTER}).

OK, so it adds a second From: header, but as it gets added after the
original it doesn't seem to matter because it works and
"replacement-string" is what gets displayed on the phone, which is what
I want.  I also don't see that the tag= in the header makes any
difference either.

Can anyone see any probs I am likely to encounter using this?



> 
> > >  or callerid in your zapata.conf
> > > for each channel.
> > 
> > Tried that - no dice.
> 
> Send your zapata.conf file so we can see what you tried. AFAICT,
> asterisk is sometimes picky with the formatting of the callerid info.
> 
> Regards,
> Adam
-- 
Howard.
LANNet Computing Associates;
Your Linux people <http://www.lannetlinux.com>
------------------------------------------
"When you just want a system that works, you choose Linux;
when you want a system that just works, you choose Microsoft."
------------------------------------------
"Flatter government, not fatter government;
Get rid of the Australian states."





More information about the asterisk-users mailing list