dynamically create/remove sip users via AMI possible?

351 views
Skip to first unread message

fwoeck

unread,
Jul 6, 2011, 12:50:29 PM7/6/11
to Adhearsion
Hi, fromt what I read, I think it should be possible to create sip
users like this

[002]
encryption=yes
transport=tls
type=friend
...

on the fly via the Asterisk Manager Interface. I connected my asterisk
server and see

INFO ami: Successful AMI actions-only connection into
ahn...@127.0.0.1
INFO ami: Successful AMI events-only connection into ahn...@127.0.0.1

but don't know where to go from there.
I'd be thankful for any hint!
--Frank

Ben Klang

unread,
Jul 6, 2011, 12:57:12 PM7/6/11
to adhea...@googlegroups.com
On Jul 6, 2011, at 12:50 PM, fwoeck wrote:

Hi, fromt what I read, I think it should be possible to create sip
users like this

[002]
encryption=yes
transport=tls
type=friend
...

on the fly via the Asterisk Manager Interface. I connected my asterisk
server and see

INFO ami: Successful AMI actions-only connection into
ahn...@127.0.0.1
INFO ami: Successful AMI events-only connection into ahn...@127.0.0.1


That is the Adhearsion process booting up and establishing the configured connections.  You will need to create some code that sends instructions to Asterisk.

The first thing you need to do is write code to tell Asterisk what to do.  Specifically, you need to tell Asterisk to update its configuration with the SIP information you pasted.  The AMI command you want is UpdateConfig and some docs on it can be found here:
The next question: how are you wanting to trigger such an action? I'll assume you want to use a web interface to manage these settings.  If you are using Rails, I would point you to Ben Langfeld's https://github.com/benlangfeld/ahn-rails which provides helper methods for calling Adhearsion methods from Rails via DRb.

From there, you just need to tie the two pieces together.  Your UpdateConfig manager code should go into an Adhearsion Component so it can be exposed via DRb.  There is more information on getting started with Components on the Adhearsion wiki:

Take a look at those resources and let us know how it goes!
/BAK/

-- 
Ben Klang

Mojo Lingo -- Voice applications that work like magic
Twitter: @MojoLingo



but don't know where to go from there.
I'd be thankful for any hint!
--Frank

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to adhea...@googlegroups.com.
To unsubscribe from this group, send email to adhearsion+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en.


Ben Langfeld

unread,
Jul 6, 2011, 1:05:27 PM7/6/11
to adhea...@googlegroups.com
Actually, that bit about ahn-rails is a lie. It's been neglected a little. At the moment, all it provides is generators. I'll add a DRb connection in there soon.

Regards,
Ben Langfeld

fwoeck

unread,
Jul 6, 2011, 1:04:55 PM7/6/11
to Adhearsion
Hi Ben, wow - that's a quick and proficient answer - thank you for
that!
Indeed we try to let our rails process mirror the frontend users as
sip users to provide them conference calls (via ConfBridge e.g.).
I'll dig into the resources you mentioned!
--Frank

On 6 Jul., 18:57, Ben Klang <bkl...@mojolingo.com> wrote:
> On Jul 6, 2011, at 12:50 PM, fwoeck wrote:
>
>
>
>
>
> > Hi, fromt what I read, I think it should be possible to create sip
> > users like this
>
> > [002]
> > encryption=yes
> > transport=tls
> > type=friend
> > ...
>
> > on the fly via the Asterisk Manager Interface. I connected my asterisk
> > server and see
>
> > INFO ami: Successful AMI actions-only connection into
> > ahn_...@127.0.0.1
> > INFO ami: Successful AMI events-only connection into ahn_...@127.0.0.1
>
> That is the Adhearsion process booting up and establishing the configured connections.  You will need to create some code that sends instructions to Asterisk.
>
> The first thing you need to do is write code to tell Asterisk what to do.  Specifically, you need to tell Asterisk to update its configuration with the SIP information you pasted.  The AMI command you want is UpdateConfig and some docs on it can be found here:https://wiki.asterisk.org/wiki/display/AST/ManagerAction_UpdateConfig
>
> The next question: how are you wanting to trigger such an action? I'll assume you want to use a web interface to manage these settings.  If you are using Rails, I would point you to Ben Langfeld'shttps://github.com/benlangfeld/ahn-railswhich provides helper methods for calling Adhearsion methods from Rails via DRb.
>
> From there, you just need to tie the two pieces together.  Your UpdateConfig manager code should go into an Adhearsion Component so it can be exposed via DRb.  There is more information on getting started with Components on the Adhearsion wiki:https://github.com/adhearsion/adhearsion/wiki/Component-System
>
> Take a look at those resources and let us know how it goes!
> /BAK/
>
> --
> Ben Klang
> bkl...@mojolingo.com
> 404.475.4841
>
> Mojo Lingo -- Voice applications that work like magichttp://mojolingo.com
Reply all
Reply to author
Forward
0 new messages