|
From: Tito G. <tit...@gm...> - 2008-04-17 21:54:15
|
Try to use the method sippeers() and get the callback of the event
PeerEntry.
self.register_event('PeerEntry', self.handle_peerentry)
def handle_peerentry(self, event, manager):
var1 = event.message.get_header('ObjectName')
var2 = event.message.get_header('Channeltype')
var3 = event.message.get_header('Status')
Something like this...
Regards,
Tito
On Thu, Apr 17, 2008 at 3:11 PM, Matthew Nicholson <mni...@di...>
wrote:
> In that case, that functionality may just be broken.
>
> On Thu, 2008-04-17 at 11:02 -0700, Stephen Cattaneo wrote:
> > Hi Matthew,
> >
> > Thanks for the response.
> > From the ami:
> > action: command
> > command: sip show peers
> >
> > Response: Follows
> > Privilege: Command
> > Name/username Host Dyn Nat ACL Port Status
> > 1044 (Unspecified) D 0
> Unmonitored
> > 1045/1045 192.168.14.218 D 5060
> Unmonitored
> > 1001/1001_6187 192.168.14.218 D 5060
> Unmonitored
> > 2002 (Unspecified) D 0
> Unmonitored
> > 2001/2001 192.168.15.175 D 5060
> Unmonitored
> > 5 sip peers [Monitored: 0 online, 0 offline Unmonitored: 3 online, 2
> > offline]
> > --END COMMAND--
> >
> > 'print asterManger.command('sip show peers').data' returns:
> > No clue what we got
> > --END COMMAND--
> >
> > Name/username Host Dyn Nat ACL Port Status
> >
> > Matthew Nicholson wrote:
> > > Try something like 'print asterManger.command('sip show peers').data'
> > > and see if that works for you.
> > >
> > > On Thu, 2008-04-17 at 10:01 -0700, Stephen Cattaneo wrote:
> > >
> > >> Hello all,
> > >>
> > >> I was hoping to be able to view the list of registered sip peers
> using
> > >> asterisk.manager.command().
> > >> Documentation seems to be pretty scarce. I would assume either:
> > >> asterisk.manager.command('sip show peers') or
> > >> asterisk.manager.command('command: sip show peers')
> > >> to be the correct. Neither of these seem to work. Any help would be
> > >> appreciated.
> > >>
> > >> The following code returns:
> > >> No clue what we got
> > >> --END COMMAND--
> > >>
> > >> thanks,
> > >>
> > >> Steve
> > >>
> > >> [code]
> > >> #!/usr/bin/python
> > >>
> > >> from asterisk import manager
> > >>
> > >> asterisk_ip = "192.168.13.3"
> > >> asterisk_user = "root"
> > >> asterisk_passwd = "voice123"
> > >>
> > >> def handle_shutdown(event, manager):
> > >> print "Received shutdown event"
> > >> manager.close()
> > >>
> > >> def handle_event(event, manager):
> > >> print "Received event: "+ event.name
> > >>
> > >> asterManger = manager.Manager( )
> > >> asterManger.connect( asterisk_ip )
> > >> asterManger.login( asterisk_user, asterisk_passwd )
> > >>
> > >> #register some call backs
> > >> asterManger.register_event('Shutdown', handle_shutdown) # shutdown
> > >> asterManger.register_event('*', handle_event) # catch all
> > >>
> > >> print asterManger.command('sip show peers')
> > >>
> > >> print asterManger.command('command: sip show peers')
> > >> [/code]
> > >>
> > >>
> -------------------------------------------------------------------------
> > >> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> > >> Don't miss this year's exciting event. There's still time to save
> $100.
> > >> Use priority code J8TL2D2.
> > >>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> > >> _______________________________________________
> > >> Pyst-users mailing list
> > >> Pys...@li...
> > >> https://lists.sourceforge.net/lists/listinfo/pyst-users
> > >>
> >
> >
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> > Don't miss this year's exciting event. There's still time to save $100.
> > Use priority code J8TL2D2.
> >
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> > _______________________________________________
> > Pyst-users mailing list
> > Pys...@li...
> > https://lists.sourceforge.net/lists/listinfo/pyst-users
> --
> Matthew Nicholson
> Digium
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Pyst-users mailing list
> Pys...@li...
> https://lists.sourceforge.net/lists/listinfo/pyst-users
>
--
Linux User #387870
____
_/_õ|__|
º[ .-.___.-._| . . . .
_(o).__(o).:_____
|