[asterisk-users] OUTBOUND CALLER ID

A J Stiles asterisk_list at earthshod.co.uk
Tue May 10 03:30:54 CDT 2011


On Tuesday 10 May 2011, mahesh katta wrote:
> sir,
>
> Below configuration i wase made in server . but this is not working.
>
>
> exten => _90XXXXXXXXX,1,NoOp(${CALLERID(num)})
> exten => _90XXXXXXXXX/5001,2,Set(CALLERID(name)=44578999)
> exten => _90XXXXXXXXX,3,AGI(agi://127.0.0.1:4577/call_log)
> exten => _90XXXXXXXXX/5001,4,Set(CALLERID(num)=44578999)
> exten =>
> _90XXXXXXXXX,5,MixMonitor(/var/spool/asterisk/astrec/${TIMESTAMP}-${CALLERI
>DNUM}-${EXTEN}-${UNIQUEID}.gsm|av(0)V(0)) exten =>
> _90XXXXXXXXX,6,Dial(${TRUNK}/${EXTEN:1},,tTo)
> exten => _90XXXXXXXXX,7,Hangup

OK.  Here's what I see going on.

When you dial 90XXXXXXXXX:
Stage 1:  The NoOp() will just write the CALLERID(num) to the console.  (This 
initially will be the originating extension number.)
Stage 2:  If the originating extension is 5001, the CALLERID(name) will be set 
to 44578999.
Stage 3:  Calls an AGI script, presumably to log the call outside of the CDR 
database.
Stage 4:  If the originating extension is 5001, the CALLERID(num) will be set 
to 44578999.
Stage 5:  Starts a recording.
Stage 6:  Passes the dialled number, skipping 1 digit from the beginning  
(i.e. the initial 9 for the outside line),  to a Dial() command.
Stage 7:  Hangs up.

I'm not at all convinced that this is right, especially as you are mixing 
destination extensions with and without originating extensions.  And, the way 
this bit is written, it will only ever set the outgoing caller ID for 
extension 5001.  

I think it needs to be more like this.  Here, I'm taking an educated guess 
that you want your caller ID to appear on outgoing calls as 445789 followed 
by the last 2 digits of the extension number.  If this is not right, you will 
have to change it -- or explain exactly how to derive the caller ID you want 
to appear on external phones, from the originating internal extension, like I 
originally asked.

exten => _90XXXXXXXXX,1,NoOp(${CALLERID(num)})
exten => _90XXXXXXXXX,2,Set(outgoing_ident=445789${CALLERID(num):-2})
exten => _90XXXXXXXXX,3,NoOp(${outgoing_ident})
exten => _90XXXXXXXXX,4,Set(CALLERID(name)=${outgoing_ident})
exten => _90XXXXXXXXX,5,AGI(agi://127.0.0.1:4577/call_log)
exten => _90XXXXXXXXX,6,Set(CALLERID(num)=${outgoing_ident})
exten =>
_90XXXXXXXXX,7,MixMonitor(/var/spool/asterisk/astrec/${TIMESTAMP}-${CALLERIDNUM}-${EXTEN}-${UNIQUEID}.gsm|
av(0)V(0))
exten =>_90XXXXXXXXX,8,Dial(${TRUNK}/${EXTEN:1},,tTo)
exten => _90XXXXXXXXX,9,Hangup

What this will do:

Stage 1:  The NoOp() will just write the CALLERID(num) to the console.  (This 
initially will be the originating extension number.)
Stage 2:  Creates a variable "outgoing_ident".  This consists of the string 
445789 followed by the last 2 digits of the originating extension number.
Stage 3:  The NoOp() will write the value of ${outgoing_ident} to the console.
Stage 4:  Sets CALLERID(name) to the value we just put into ${outgoing_ident}.
Stage 5:  Calls logging AGI script.
Stage 6:  Sets CALLERID(num) to the value we just put into ${outgoing_ident}.  
This is most likely to be noticed.
Stage 7:  Starts recording.
Stage 8:  Passes the dialled number, skipping 1 digit from the beginning, to a 
Dial() command.
Stage 9:  Hangs up.

Modify stage 2 if necessary to suit exactly how you want your outgoing ident 
to appear.  You can take out the NoOp() statements and renumber appropriately 
once it's working as you want it.

Note that if the console seems to show you created the right ident but it 
doesn't appear on phones when you dial out, then either the format is wrong 
or your telco doesn't think you are authorised to use that ident; this is a 
matter you will need to take up with your phone company.

-- 
AJS

Answers come *after* questions.



More information about the asterisk-users mailing list