Koozali.org: home of the SME Server
Obsolete Releases => SME VoIP (Asterisk, SAIL etc) => Topic started by: boobee on April 09, 2007, 11:10:42 AM
-
Hi all,
I ask for this here instead of writing directly to selintra as it could be interesting for a greater audience..
I wonder if it's possible without too much hassle to have sail to lookup from a database (or even sme's ldap address book?) for external incoming calls, I'd rather see on phones the name of who's calling me instead of an unfriendly number, so friends, clients, colleagues could be answered first and unknow callers could wait longer in the queue.
thanks!
-
well,
seems like it's an already supported feature of asterisk since 1.0 as per
http://www.voip-info.org/tiki-index.php?page=Asterisk%20cmd%20LookupCIDName via asterisk database. they suggest exten => s,X,LookupCIDName
and simply adding numbers <-> name via database put cidname 12345 "John Smith"
but don't know very well where/how to put the first line (into extensions.conf) with sail..
thanks
-
Hi Guys,
As you can see from the above, the asterisk database is capable of holding and looking up numbers but it's a bit of a pain since it's such a non-standard beast - openPBX has dropped it in favour of SQLite which at least makes it open and accessible.
An LDAP retrieval mechanism would be much more interesting but the only current Asterisk implementations use Perl. Now, there's nothing wrong with Perl but I shudder to think what overhead it puts onto Asterisk when it's being loaded in real time every time a call arrives....
Snom have a good LDAP directory access mechanism for their phones but unfortunately it won't do a reverse look-up when a call arrives (at least, if it can, then neither we nor the UK distibutor can figure it out).
Aastra have a good central tftp/http directory solution which works well. You populate a central file on the TFTP of HTTP server and the phones load the directory each time they boot. The phone will automatically do the reverse look up for you each time a call arrives. Nice, but limited to one manufacturer. Others do similar things but there really isn't any standard way of doing it (at least until Microsoft's Universal Media Server becomes endemic, by which time, all the phone manufacturers will certainly have produced an ExchangeServer interface, which will at least bring a measure of uniformity to the proceedings, whatever you may think of Bill and his boys).
So there you go. Great idea but thin on tools at the moment.
Best
Selintra
-
[...]
An LDAP retrieval mechanism would be much more interesting but the only current Asterisk implementations use Perl. Now, there's nothing wrong with Perl but I shudder to think what overhead it puts onto Asterisk when it's being loaded in real time every time a call arrives....
[...]
So there you go. Great idea but thin on tools at the moment.
hi again! i just came across this: http://www.mezzo.net/asterisk/app_ldap.html
isn't this the right tool we were thin on since a while ago, a native C app module for asterisk 1.4? :wink:
cheers
b.
-
the app compiles ok, loads fine with "load app_ldap.so" from CLI and is running ("show application LDAPget"), but again i'm stumped at how i should edit extensions.conf to enable the lookup and show names instead of numbers on phone's display without messing everything up.. :(
selintra-sail-2.1.15-483 and smeserver-asterisk-1.4.1-8
thanks again
-
How good is your Perl?
We don't have the cycles to look at this until maybe end of the month, but we'd be happy to show you where to make the changes if you want to have a go.
Kind Regards
S
-
my.. what?
ehm, quite bad, but if it doesn't take too long for you to show me, please shoot, i'll enjoy spending some time to figure it out or, as last resort, just wait without hammering if i really can't afford it..
thanks a lot!
-
Good man!
OK, we lied about the Perl stuff :-)....
Create a custom app and set the span to external. Call it whatever you like. In your inbound trunk, point the Open route to your custom app. When a call arrives, SAIL will deliver it to your custom app. You can now do whatever you like with it (including dial statements etc etc).
Custom app flow will be something like (in pseudocode)
exten=>s,1,{do LDAP lookup and assign to CALLERID}
exten=>s,2,{dial an extension}
exten=>s,3,Hangup
If you want to properly integrate your code into SAIL itself you can ask SAIL to do the Dial for you with something like...
exten=>s,1,{do LDAP lookup and assign to CALLERID}
exten => s,2,agi(selintra,InCall,{extension or Alias you want to call})
exten=>s,3,Hangup
Kind Regards
S
-
Hi again,
thanks for the tips.. and for the excellent news about Perl not being involved! :D
i promised i won't hammer on this, just some good/bad news from the lookup side..
i COULD lookup from ldap, and that's really good, but something goes bang when it's time to route calls to phones with the piece of code you gave me, with and w/o brackets.
exten => s,2,agi(selintra,InCall,{extension or Alias you want to call})
7000 is an alias for "5001 5002 5003", 3 SIP users i have around.
boobee telephoneNumber into local ldap is '1234567890'
public numbers/names are not real.
CLI>
-- Starting simple switch on 'Zap/2-1'
-- Executing [s@mainmenu:1] GotoIf("Zap/2-1", "0?s-Zap1-1|1") in new stack
-- Executing [s@mainmenu:2] GotoIf("Zap/2-1", "1?s-Zap2-1|1") in new stack
-- Goto (mainmenu,s-Zap2-1,1)
-- Executing [s-Zap2-1@mainmenu:1] AGI("Zap/2-1", "selintra|Inbound|Zap2-1") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/selintra
-- AGI Script Executing Application: (Background) Options: (silence/2)
-- <Zap/2-1> Playing 'silence/2' (language 'en')
-- AGI Script selintra completed, returning 0
-- Executing [s@ldapcid:1] LDAPget("Zap/2-1", "CALLERID=lookupcid/||) exten=>s|2|agi(selintra|InCall|{7000}") in new stack
-- LDAPget: varname=CALLERID, config-section=lookupcid, keys=||) exten=>s|2|agi(selintra|InCall|{7000}
== Parsing '/etc/asterisk/ldap.conf': Found
> LDAPget: ldap://localhost/dc=localhost,dc=localdomain?cn?sub?(&(objectClass=*)(telephoneNumber=${CALLERID(number)}))
-- LDAPget: ldap://localhost/dc=localhost,dc=localdomain?cn?sub?(&(objectClass=*)(telephoneNumber=1234567890))
-- LDAPget: bind to localhost anonymously
-- LDAPget: cn=boobee
-- LDAPget: convert: UTF-8 -> ISO-8859-1
-- LDAPget: set CALLERID='boobee'
== Auto fallthrough, channel 'Zap/2-1' status is 'UNKNOWN'
-- Hungup 'Zap/2-1'
my /etc/asterisk/ldap.conf
[lookupcid]
host = localhost
version = 3
base = dc=localhost,dc=localdomain
convert = UTF-8, ISO-8859-1
and my custom app 'ldapcid'
exten=>s,1,LDAPget(CALLERID=cidname/${CALLERIDNUM},${CALLERIDNUM},${CALLERIDNUM})
exten=>s,2,agi(selintra,InCall,{7000})
exten=>s,3,Hangup
if i change the destination for inbound calls back to alias 7000 instead of my app, all works fine again.
-
Hi,
Sorry - bad notation on our part. The curly brackets were just to show an optional parameter... Try....
exten=>s,2,agi(selintra,InCall,7000)
..should work - If it doesn't, we'll think of something else ;-)
Best
S[/quote]
-
Sorry - bad notation on our part. The curly brackets were just to show an optional parameter... Try....
exten=>s,2,agi(selintra,InCall,7000)
..should work - If it doesn't, we'll think of something else
[...]something goes bang when it's time to route calls to phones with the piece of code you gave me, with and w/o brackets.
already tried with no braces, but it's still claiming about Zap/2-1 status UNKNOWN and then it hangs up immediately..
maybe that Perl approach is now required? :wink:
regards
b.
-
Sorry Boobee
We gave you some bad info. You use InCall if you are only ringning a single SIP extension. If you want to ring a group (Alias) you use...
exten => 288,1,agi(selintra,Alias,SIP/6044 SIP/6035 SIP/6042,${EXTEN})
So, for your call you can do...
exten=>s,1,LDAPget(CALLERID=cidname/${CALLERIDNUM},${CALLERIDNUM},${CALLERIDNUM})
exten=>s,2,GoTo(7000,1)
exten=>7000,1,agi(selintra,Alias,SIP/nnnn SIP/nnnn SIP/nnnnn,${EXTEN})
exten=>7000,2,Hangup
The SIP/nnnn entries should be substituted with the real extension numbers you want to call... e.g. SIP/6004 SIP/6005... and so on.
Wouldn't it be nice if we knew how our own product worked? Heigh ho...
Try that.
-
Wouldn't it be nice if we knew how our own product worked? Heigh ho...
Try that.
happens to me everyday for most stupid things, stress and too little sleep don't help me that much though.
anyway, still out of luck..
there must be something wrong with the ldap lookup or its exit code i suppose.. i tried BTW the InCall bit again with a single sip extension in place of an alias, but it won't change a single line of the error.
always
== Auto fallthrough, channel 'Zap/2-1' status is 'UNKNOWN'
-- Hungup 'Zap/2-1'
thanks very much guys for your time spent here
PS: meanwhile, i drained my gsm credit because of the initial fax detection on the 30+ test calls i did :?
-
We think it might be because the LDAP lookup adds +101 to the linecounter.
Try this...
exten=>s,1,LDAPget(CALLERID=cidname/${CALLERIDNUM},${CALLERIDNUM},${CALLERIDNUM})
exten=>s,2,GoTo(7000,1)
exten->s,102,GoTo(7000,1)
exten=>7000,1,agi(selintra,Alias,SIP/nnnn SIP/nnnn SIP/nnnnn,${EXTEN})
exten=>7000,2,Hangup
Best
S
-
hey, you did it!
now calls are incoming correctly, while the name is still not presented, just the number, the classic way, on ip phone and softphones.
we are approaching the goal..
i promise a little howto/wiki page (for what it's worth) for the weekend if you can fix this, should be a piece of cake right now, shouldn't it? :wink:
-
OK good,
Let's just check first that LDAP is working ...
Try this...
exten=>s,1,LDAPget(MYCALLERID=cidname/${CALLERIDNUM})
exten=>s,2,GoTo(7000,1)
exten->s,102,GoTo(7000,1)
exten=>7000,1,NoOp(${MYCALLERID})
exten=>7000,2,Set (CALLERID(name)=${MYCALLERID})
exten=>7000,3,agi(selintra,Alias,SIP/nnnn SIP/nnnn SIP/nnnnn,${EXTEN})
exten=>7000,4,Hangup
This will show the LDAP returned caller id value on the console just before it hands control to the agi.
Best
S
-
exten=>7000,2,Set(CALLERID(name)=${MYCALLERID})
that was the missing bit! without the extra space after "Set" which was unintentional for sure.
you made my day, and my girlfriend's one too! it just works, name is now displayed instead of numbers on our home phones.
i suppose as it's working now it will just require some extra cosmetics for editing sme's ldap address book (i use phpldapadmin contrib) but you're quite ready for production..
big thanks to you/your team for the excellent support provided!
b.
-
as promised, a small howto on the wiki:
http://wiki.contribs.org/Sail_and_LDAP
please anyone feel free to comment/edit
-
Cool
:-)
thx
S
-
Hi guys,
I'm trying to get this working on a stabled version of SAIL, running asterisk 1.2.
I have compiled the App_ldap 1.0rc6 and it seems working.
I have the functionality working, but only getting numbers, seems like it's not reading from LDAP.
How can I test the funcionality? AGI DEBUG shows me:
AGI Tx >> agi_request: selintra
AGI Tx >> agi_channel: Zap/3-1
AGI Tx >> agi_language: br
AGI Tx >> agi_type: Zap
AGI Tx >> agi_uniqueid: 1190607628.20
AGI Tx >> agi_callerid: 051841183XX
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: ldap
AGI Tx >> agi_extension: 2101
AGI Tx >> agi_priority: 3
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode: