News & Reviews
More How-To's & Tips More News
More Reviews Device Configuration Tools
No account yet? Create one
Forgot your Username or Password?

Welcome to the Voxilla VoIP Forum.

Voxilla has been a trusted source for accurate, up-to-date information on the IP Communications industry since 2002. A dedicated staff of reporters and engineers produce feature articles and product reviews to keep industry watchers abreast of the people, companies, and trends driving a fast moving market.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.





Closed Thread
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old September 25th, 2006, 10:22 AM
rizsher rizsher is offline
Senior Member
 
Join Date: Jul 2004
Posts: 1,114
rizsher
Default Asterisk CLI - Add Name to CID

Moving my query to a different thread. This is the initial post I made:

Quote:
Originally Posted by rizsher View Post
Chandave,

Not trying to hijack this thread, but, could you please tell me exactly where does the name we assign to a CID appear?. Does it appear as the name of the caller on the phone display, or, in the Call Detail Reports?

In my case, I took a number as it appeats in the 3rd column of FreePBX Call Detail Reports, the Title of the column is "Source", added it to the database using put cidname, get the followign result when I show

Code:
asterisk1*CLI> database show cidname 20105551234
/cidname/20105551234                              : Rizwan Turdff
however, subsequesnt calls from 20105551234 still only show the number, both on the phone and the FreePBX Call Reports STLLL only show 20105551234, "Rizwan Turdff" doesn't show anywhere...

This is the CLI output I get:

Code:
 -- Goto (timeconditions,1,1)
    -- Executing GotoIfTime("SIP/81123456-098df990", "00:10-07:00|*|*|*?ivr-3|s|1") in new stack
    -- Executing Goto("SIP/81123456-098df990", "ext-findmefollow|111|1") in new stack
    -- Goto (ext-findmefollow,111,1)
    -- Executing Macro("SIP/81123456-098df990", "user-callerid|") in new stack
    -- Executing GotoIf("SIP/81123456-098df990", "0?report") in new stack
    -- Executing GotoIf("SIP/81123456-098df990", "0?start") in new stack
    -- Executing Set("SIP/81123456-098df990", "REALCALLERIDNUM=20105551234") in new stack
    -- Executing NoOp("SIP/81123456-098df990", "REALCALLERIDNUM is 20105551234") in new stack
    -- Executing Set("SIP/81123456-098df990", "AMPUSER=") in new stack
    -- Executing AGI("SIP/81123456-098df990", "calleridname.agi") in new stack
  -- Launched AGI Script /var/lib/asterisk/agi-bin/calleridname.agi calleridname.agi: CALLERID IS: 20105551234 calleridname.agi: Unable to parse phone number for NPA/NXX/station. Phone number is: 20105551234
    -- AGI Script calleridname.agi completed, returning 0
    -- Executing Set("SIP/81123456-098df990", "AMPUSERCIDNAME=") in new stack
    -- Executing GotoIf("SIP/81123456-098df990", "1?report") in new stack
    -- Goto (macro-user-callerid,s,10)
    -- Executing NoOp("SIP/81123456-098df990", "Using CallerID "20105551234" <20105551234>") in new stack
    -- Executing GotoIf("SIP/81123456-098df990", "0?NEWPREFIX") in new stack
    -- Executing Set("SIP/81123456-098df990", "CALLERID(name)=20105551234") in new stack
    -- Executing Set("SIP/81123456-098df990", "RGPREFIX=") in new stack
    -- Executing Set("SIP/81123456-098df990", "CALLERID(name)=20105551234") in new stack
Following is the macro-user-callerid section of my extensions.conf file:

Code:
[macro-user-callerid]
exten => s,1,GotoIf($["${CHANNEL:0:5}" = "Local"]?report) 
exten => s,n,GotoIf($["${REALCALLERIDNUM:1:2}" != ""]?start)
exten => s,n,Set(REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),NoOp(REALCALLERIDNUM is ${REALCALLERIDNUM})
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,AGI(calleridname.agi)
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($["x${AMPUSERCIDNAME:1:2}" = "x"]?report) 
exten => s,n,Set(CALLERID(all)=${AMPUSERCIDNAME} <${AMPUSER}>)
exten => s,n(report),NoOp(Using CallerID ${CALLERID(all)})
 
; overrides callerid out trunks
; arg1 is trunk
; macro-user-callerid should be called _before_ using this macro

I added exten => s,n,AGI(calleridname.agi) following the steps on the nerdvittles website.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2 (permalink)  
Old September 25th, 2006, 10:23 AM
rizsher rizsher is offline
Senior Member
 
Join Date: Jul 2004
Posts: 1,114
rizsher
Default Re: Asterisk CLI - Add Name to CID

to which Chandave gave the following reply:
Quote:
Originally Posted by chandave View Post
(Looks like you have a typo in the phone number or someone is purposely prefixing a zero to your NXX...)


The CIDnum Asterisk is getting is:
20105551234
which is not in the format calleridname.agi expects. It expects a 10 digit number so it can parse it out as NPA (3-digits), NXX (3-digits), and STATION (4-digits). That's why you are getting the "Unable to parse phone number for NPA/NXX/station. Phone number is: 20105551234" message.

If you really want it to work, you can add the following between lines 47 and 48:
Code:
elsif ( (length($callerid)==11) && (substr($callerid,3,1)==0) && ($callerid =~ /^(\d{3})(\d{4})(\d{4})$/) ) {
$npa = $1;
$nxx = $2;
$station = $3;
$AGI->verbose("Checking funky zero-prefixed NXX: $npa $nxx $station...\n");
}
So, it would look something like:
Code:
$AGI->verbose("Checking $npa $nxx $station...\n");
}
elsif ( (length($callerid)==11) && (substr($callerid,3,1)==0) && ($callerid =~ /^(\d{3})(\d{4})(\d{4})$/) ) {
......
else {
$AGI->verbose("Unable to parse phone number for NPA/NXX/station. Phone number is: $callerid\n");
exit(0);
}
And to answer your other questions:

The CIDName will appear in your CDR (probably in /var/log/asterisk/cdr-csv/Master.csv) in the 5th column as "Real Name <cidnum>". How it appears on the phone is up to your phone...if it even understands CIDName.

See ya...

d.c.

(rizsher or Eric: please move this thread to a new topic if we need to continue it)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3 (permalink)  
Old September 25th, 2006, 10:29 AM
rizsher rizsher is offline
Senior Member
 
Join Date: Jul 2004
Posts: 1,114
rizsher
Default Re: Asterisk CLI - Add Name to CID

Chandave,

I wasn't aware the script only worked for North American naming system. I'm actually in Egypt, and receive calls from Pakistan/Egypt/UK, in addition to the USA. Each country has its own number convention, and depending on the trunk being called, the incoming CLI is different as well, the 20105551234 number is actually my egyptian mobile phone... and... if I call my USA Incoming DID, it appears as 0020105551234, on the UK DID, it strips the 00.

Actually, I thought, since I was actually physically assigning a name to the number, it shoudln't matter if the number is in the NANP format or not. Is there a non-north american version of callingname available somewhere?

Thanks for all your help.

Regards.
Rizwan Sher
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4 (permalink)  
Old September 25th, 2006, 01:29 PM
chandave chandave is offline
Senior Member
 
Join Date: Jul 2005
Posts: 362
chandave is an unknown quantity at this point
Send a message via MSN to chandave
Default Re: Asterisk CLI - Add Name to CID

Well, if you are only using the calleridname.agi to retrieve CIDname from your own Asterisk database, then you can change:
Code:
elseif ( (length($callerid)==11) && (substr($callerid,3,1)==0) && ($callerid =~ /^(\d{3})(\d{4})(\d{4})$/) ) {
$npa = $1;
$nxx = $2;
$status = $3;
$AGI->verbose("Checking funky zero-prefixed NXX: $npa $nxx $station...\n");
}
to

Code:
elsif ( (length($callerid)>10) && ($callerid =~ /^(\d+)$/) ) {
$station = $1;
$AGI->verbose("Checking non NA-NPA formatted number $station...\n");
}
Also, make sure:
Code:
$Fonetastic = '0';
$AnyWho = '0';
$Google = '0';
$Asteridex = '1';
To force calleridname.agi to only lookup the info from your Asterisk database.

See ya...

d.c.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5 (permalink)  
Old September 26th, 2006, 09:01 PM
rizsher rizsher is offline
Senior Member
 
Join Date: Jul 2004
Posts: 1,114
rizsher
Default Re: Asterisk CLI - Add Name to CID

Got it working by installing the module, steps here
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old September 26th, 2006, 09:01 PM
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:



Similar Threads for: Asterisk CLI - Add Name to CID
Thread Thread Starter Forum Replies Last Post
Asterisk CLI Database PUT question.. DGrant303 Asterisk Support Forum 6 September 25th, 2006 10:24 AM
SIPURA 3000 -> Asterisk and CID bulimia Linksys (Sipura) VoIP Support Forum 8 July 7th, 2006 09:40 PM
log into asterisk CLI as normal user baddah Asterisk Support Forum 5 July 7th, 2006 07:26 PM
How to add multiple registrations to Asterisk@home ? JPF Asterisk Support Forum 7 October 7th, 2005 12:37 AM
Asterisk & Sipura SPA-2000 loses 3 digits off end of CLI timfhdavidson Asterisk Support Forum 1 January 18th, 2005 07:50 PM



All times are GMT. The time now is 11:27 AM.


vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc. Logos and trademarks are the property of Voxilla or their respective owner. All other content © 2003-2007 by Voxilla, Inc.