[asterisk-users] What's up with the Manager Interface?!?!
James Texter
james.texter at cox.net
Wed Nov 29 15:03:02 MST 2006
Doug,
Your issue isn't with the manager. It's with the CLI output you are
trying to hijack via manager :D If you run "sip show peer 2944093" in the
CLI, you'll see a blank line, followed by a line that is "* Name". It
appears what you really want is a manager Action to show a sip peer, in
which case I would recommend adding a new manager command that returns a
string which is much more machine readable. Remember, CLI output is
designed to be human readable.
Just my $0.02.
On 11/29/06 3:36 PM, "Douglas Garstang" <dgarstang at oneeighty.com> wrote:
>> -----Original Message-----
>> From: Douglas Garstang
>> Sent: Wednesday, November 29, 2006 12:26 PM
>> To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
>> Subject: RE: [asterisk-users] What's up with the Manager Interface?!?!
>>
>>
>>> -----Original Message-----
>>> From: Michael Collins [mailto:mcollins at fcnetwork.com]
>>> Sent: Wednesday, November 29, 2006 11:20 AM
>>> To: Asterisk Users Mailing List - Non-Commercial Discussion
>>> Subject: RE: [asterisk-users] What's up with the Manager
>> Interface?!?!
>>>
>>>
>>>> Sometimes the data comes back separated by \r\n, and
>> sometimes it's
>>>> separated by \n.
>>>> The whole thing is completely inconsistent, and trying to
>> write any
>>> kind
>>>> of API for it is -GHASTLY-
>>>
>>> Doug,
>>>
>>> What language(s) are you using? Just curious. I've been
>>> tinkering with
>>> Perl, POE, and POE::Component::Client::Asterisk::Manager.
>> These have
>>> abstracted away the lowest level of programming.
>>>
>>> I know you've done Python in the past - I hear that there's a
>>> module for
>>> AMI called py-Asterisk. Have you seen or tried that? Ditto
>>> with Ruby -
>>> a module called RAMI. Both are on sourceforge.
>>>
>>> Also, could you hum a few bars about what you're trying to
>> accomplish
>>> with your API? I'm curious about the big picture.
>>
>> Michael, I'm using python.
>>
>> Here's a good example. I'm trying to get SIP blf. I managed
>> to split my result into a list of lines by splitting on ANY
>> of \r\n, \n or \r. I was going use the column headings from
>> the third line as my keys for my dictionary/hash, rather than
>> hard coding them. Notice anything? The 'Call ID' column has a
>> space right in the middle which means I can't simply split
>> this up by white-space.
>>
>> Response: Follows
>> Privilege: Command
>> Peer User Call ID Extension
>> Last state Type
>> xxx.187.128.105 2944090 f7ee98da-6d 2944006
>> InUse xpidf+xml
>> xxx.187.128.105 2944090 111e388b-6b 2944077
>> Idle xpidf+xml
>>
>> I think I looked at the python module and was underwhelmed by it.
>
> Grrrr. Here's another example...
>
> Action: Command
> Command: sip show peer 2944093
>
> Response: Follows
> Privilege: Command
>
>
> * Name : 2944093
> Secret : <Set>
> MD5Secret : <Not set>
> Context : 180o_CallStart
> Subscr.Cont. : 180o_WatchBLF
>
> Why the HELL is there an asterisk before 'Name'? Now I have to strip the
> bloody thing out!
> And why is there TWO empty lines before it?
> Good grief!
>
> Doug.
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
--
James Texter
More information about the asterisk-users
mailing list