Page 313 - Asterisk™: The Future of Telephony
P. 313

function. The call is then placed via the SIP channel using the service_provider we
               created in the sip.conf file:

                   [outgoing]
                   exten => call,1,NoOp()
                   exten => call,n,Set(CALLERID(name)=${${WHO}_CID_NAME})
                   exten => call,n,Set(CALLERID(number)=${${WHO}_CID_NUMBER})
                   exten => call,n,Dial(SIP/service_provider/${E})
                   exten => call,n,Playback(silence/2&pls-try-call-later)
                   exten => call,n,Hangup()
               Our service_provider might look something like this in sip.conf:
                   [service_provider]
                   type=friend
                   host=switch1.service_provider.net
                   username=my_username
                   fromuser=my_username
                   secret=welcome
                   context=incoming
                   canreinvite=no
                   disallow=all
                   allow=ulaw
               And that’s it! The complete dialplan utilized for the hot-desk feature is displayed in full
               in Appendix G.
               How many things have you just thought of that you could apply func_odbc to? See why
               we’re so excited about this feature as well?!



                                        The func_odbc Backport
                  With Asterisk 1.4, you can use a backported version of func_odbc that uses a slightly
                  different configuration format. This allows you to use multiple DSN connections to
                  separate databases, and also to utilize the ${ODBCROWS} channel variable for SQL read
                  (SELECT) queries. To check out the backport of func_odbc and install it (which over-
                  writes the existing func_odbc.c file):
                   # cd /usr/src/
                   # svn co http://svncommunity.digium.com/svn/func_odbc/1.4 ./func_odbc-1.4
                   # cp func_odbc-1.4/func_odbc.c ./asterisk-1.4/funcs
                   # cp: overwrite `./asterisk-1.4/funcs/func_odbc.c'? y
                   # cd asterisk-1.4
                   # make install
                  The version described in this chapter works with a stock Asterisk 1.4 system, but the
                  backport (and Asterisk 1.6) will use the following syntax changes:
                   • read will become readsql
                   • write will become writesql
                   • dsn will become readhandle and writehandle (for separate read and write database
                     locations)



                                                        Getting Funky with func_odbc: Hot-Desking | 285
   308   309   310   311   312   313   314   315   316   317   318