[asterisk-users] RES: Banco de dados interno no Asterisk e variáveis em SIP HEADERS
Prezado Fernando, Muito obrigado por sua complementação na resposta! Surgiram algumas dúvidas agora: A única forma de retornar os dados num header field, como o Rafael dos Santos Saraiva sugeriu envolve criar outro channel? Ou seja, o que eu preciso é que a mesma execução do dia plan obtenha um valor recebido do Sip Client, execute uma query num banco de dados e em seguida inclua a resposta como novo hearder field na mensagem a ser enviada de resposta ao mesmo SIP Client. Tudo isso pode ser executado no mesmo channel? Ou seja, sem precisar fazer um Dial() para o Sip Client? Por exemplo: Suponha o seguinte, o SIP client envia um SIP INVITE para o Asterisk, contendo um novo header field na mensagem. O dia plan executa, faz o que tem que fazer, obtem um valor de um banco de dados e em seguida inclui esse valor como novo header field na mensagem de resposta SIP ACK 100. Ou talvez na mensagem de resposta SIP 180 (Ringing). Isso tudo seria feito num mesmo channel? O que estou imaginando é usar as mensagem padrões SIP, que o Asterisk já sabe manipular, e pegar 'carona' nelas para o transporte de pequenos dados. Algo desse tipo é possível de ser feito? No nosso projeto usaremos SIP com TCP, não com UDP, devido a outros requisitos. Isso facilitará o uso da ideia com Json, certo? Atenciosamente, RODRIGO PIMENTA CARVALHO Inatel Competence Center Software Ph: +55 35 3471 9200 RAMAL 979 -- Só complementando a resposta do amigo Rodrigo. O Comando SIPAddHeader vai adicionar um cabeçalho SIP, porém no channel atual, e o Dial, criará outro channel, o qual não irá ter o cabeçalho que você adicionou: Se quiser que o cabeçalho SIP customizado esteja disponivel e seja enviado para a Ponta B que o Dial está chamando, você terá que executar uma Macro utilizando o canal novo que será criado pelo comando Dial. Algo do Tipo: [header] exten => cid,1,SIPAddHeader(X-My-Header=MYCUSTOMHEADER) same=>n,Return(1) [meudial] exten => _X.,Dial(SIP/X.X.X.X/${EXTEN},,b(header^cid^1)) Porém, UDP tem suas limitações, e tentar incomporar JSON a SIP Message, imagino que não consiga ter uma ambiente de fácil manutenção. Uma ideia seria utilizar Kamailio ou OpenSIPs o que te da mais ferramentas para gerenciar o SIP Message. Ou você pode utilizar seu próprio esquema utilizando um sistema de mensagens TCP como o ZeroMQ ou o GearmanD. Atenciosamente / Best regards / Saludos, P Antes de imprimir pense em sua responsabilidade e compromisso com o Meio Ambiente! -- Mensagem original -- De: "Rafael dos Santos Saraiva" Para: "asteriskbrasil em listas.asteriskbrasil.org" Enviado(s): 12/06/2015 14:53:42 Assunto: Re: [AsteriskBrasil] RES: Banco de dados interno no Asterisk e variáveis em SIP HEADERS >Rodrigo > >Segue um exemplo de manipulação do SIP HEADER: > >Servidor 1: >exten => _X.,1,Answer() >same => n,SIPAddHeader(Custom-variable: "valor da minha variavel) >same => n,Dial(SIP/10.68.2.43/${EXTEN},30,tT) >same => n,HangUp >Servidor 2: >exten => _X.,1,Answer() >exten => _X.,n,NoOp(${SIP_HEADER(Custom-variable)}) >exten => _X.,n,goto(ura,s,1) >exten => _X.,n,HangUp > >Você enviar quaisquer valores que possam ser definidos numa variável. > >Neste sites você encontra maiores informações: >http://www.voip-info.org/wiki/view/Asterisk+cmd+SipAddHeader >https://wiki.asterisk.org/wiki/display/AST/Home > >O Jabber trabalha com o protocolo XMPP, de mensagens instantâneas. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Voice mail and caller ID
On Fri, Jun 12, 2015 at 3:10 PM, D'Arcy J.M. Cain wrote: > On Fri, 12 Jun 2015 11:49:05 -0700 > John Kiniston wrote: > > Try this for CHAN_SIP: > > > > same => n,Set(Peer=${SIPCHANINFO(peername)}) ; Get the peer > > same => n,Set(MailBox=${SIPPEER(${Peer},mailbox)}); Get the > > mailbox same => n,VoicemailMain(${MailBox}@LocalSets,s) ; If we > > have a mailbox defined log into it > > Perfect. Thanks. However, I didn't bother setting a variable. I just > use it directly. > > same => n,VoicemailMain(${SIPCHANINFO(peername)}@LocalSets,s) > > However... > > http://www.voip-info.org/wiki/view/Asterisk+func+sipchaninfo says that > SIPCHANINFO is deprecated and that we should use CHANNEL instead. I > tried that and it said "pbx.c: Function CHANNEL not registered". Does > that mean that this solution will eventually fail when SIPCHANINFO is > removed in some future release? I am running 11.17.1. > No. It means that you have not loaded func_channel.so. Richard -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Voice mail and caller ID
On Fri, 12 Jun 2015 11:49:05 -0700 John Kiniston wrote: > Try this for CHAN_SIP: > > same => n,Set(Peer=${SIPCHANINFO(peername)}) ; Get the peer > same => n,Set(MailBox=${SIPPEER(${Peer},mailbox)}); Get the > mailbox same => n,VoicemailMain(${MailBox}@LocalSets,s) ; If we > have a mailbox defined log into it Perfect. Thanks. However, I didn't bother setting a variable. I just use it directly. same => n,VoicemailMain(${SIPCHANINFO(peername)}@LocalSets,s) However... http://www.voip-info.org/wiki/view/Asterisk+func+sipchaninfo says that SIPCHANINFO is deprecated and that we should use CHANNEL instead. I tried that and it said "pbx.c: Function CHANNEL not registered". Does that mean that this solution will eventually fail when SIPCHANINFO is removed in some future release? I am running 11.17.1. Cheers. -- D'Arcy J.M. Cain System Administrator, Vex.Net http://www.Vex.Net/ IM:da...@vex.net VoIP: sip:da...@vex.net -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Voice mail and caller ID
Try this for CHAN_SIP: same => n,Set(Peer=${SIPCHANINFO(peername)}) ; Get the peer same => n,Set(MailBox=${SIPPEER(${Peer},mailbox)}); Get the mailbox same => n,VoicemailMain(${MailBox}@LocalSets,s) ; If we have a mailbox defined log into it If you are using PJSIP it's more complex same => n,Set(EndPoint=${CHANNEL(endpoint)}) ; Get the peer same => n,Set(MailBox=${PJSIP_ENDPOINT(${EndPoint},mailboxes)}) same => n,ExecIf($[${ISNULL(${MailBox})} = 1]?Set(MailBox=${AST_SORCERY(res_pjsip,aor,${EndPoint},mailboxes)})) same => n,VoicemailMain(${MailBox}@LocalSets,s) ; If we have a mailbox defined log into it On Fri, Jun 12, 2015 at 11:23 AM, D'Arcy J.M. Cain wrote: > I have this in my sip.conf: > > exten => *98,1,Verbose(0,CALLERID number is "${CALLERID(num)}") > same => n,VoicemailMain(${CALLERID(num)}@LocalSets,s) > same => n,Hangup > > However, my extensions are set up so that they always show the external > number, not the extension: > > [foobar2](client-phone) > secret=x > callerid=Candace <551212> > mailbox=foobar2@LocalSets > > So the caller ID is 551212 but the voice mail is foobar2. Is there > any way to get the actual extension that called? Can I create a > variable in the extension that I can read instead of ${CALLERID(num)}? > I tried setting a random string (xaccount) and reading it with > ${ENV(xaccount)} but it's not an environment variable and didn't work. > > Cheers. > > -- > D'Arcy J.M. Cain > System Administrator, Vex.Net > http://www.Vex.Net/ IM:da...@vex.net > VoIP: sip:da...@vex.net > > -- > _ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: >http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: >http://lists.digium.com/mailman/listinfo/asterisk-users > -- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. ---Heinlein -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] Voice mail and caller ID
I have this in my sip.conf: exten => *98,1,Verbose(0,CALLERID number is "${CALLERID(num)}") same => n,VoicemailMain(${CALLERID(num)}@LocalSets,s) same => n,Hangup However, my extensions are set up so that they always show the external number, not the extension: [foobar2](client-phone) secret=x callerid=Candace <551212> mailbox=foobar2@LocalSets So the caller ID is 551212 but the voice mail is foobar2. Is there any way to get the actual extension that called? Can I create a variable in the extension that I can read instead of ${CALLERID(num)}? I tried setting a random string (xaccount) and reading it with ${ENV(xaccount)} but it's not an environment variable and didn't work. Cheers. -- D'Arcy J.M. Cain System Administrator, Vex.Net http://www.Vex.Net/ IM:da...@vex.net VoIP: sip:da...@vex.net -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] Can dial plan handle new proprietary SIP HEADER fields? How?
Dear asterisk-users, I have listened that a diaplan on Asterisk can extract information from proprietary SIP messages header fields. That is, if Asterisk receives a SIP message with a modified HEADER (containing proprietary fields) , is it possible to program the dial plan to make Asterisk extract the values of such fields, being possible to handle such values in diaplan, isn't it? If it is true, is it also possible to use dial plan to make Asterisk include proprietary SIP HEADER fields in a specific SIP message? Any hint will be very helpful! Best regards. RODRIGO PIMENTA CARVALHO Inatel Competence Center Software Ph: +55 35 3471 9200 RAMAL 979 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users