Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Asterisk Manager and Visual Basic


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
andersen at mwdental.com
Guest





PostPosted: Wed Feb 13, 2008 3:31 pm    Post subject: [asterisk-users] Asterisk Manager and Visual Basic Reply with quote

Has anyone tried to used VB6 to communicate with the Asterisk Manager?

If so, would you be willing to share some basic code showing your
approach to getting connected and parsing results?

I've got a Telnet control that is allowing me to connect, authenticate
and see the "flow" of status, etc., but I'm sure there is a better way
to do this without using Telnet (maybe not?). Any suggestions?

I want to write a presence monitor (a virtual "sidecar" if you will)

Bill
Back to top
razza30 at gmail.com
Guest





PostPosted: Wed Feb 13, 2008 4:04 pm    Post subject: [asterisk-users] Asterisk Manager and Visual Basic Reply with quote

On 13/02/2008, Bill Andersen <andersen at mwdental.com> wrote:
Quote:
Has anyone tried to used VB6 to communicate with the Asterisk Manager?

If so, would you be willing to share some basic code showing your
approach to getting connected and parsing results?
Bill

I wrote some very very basic stuff ages ago using standard
mswinsck.ocx, will dig it out.
Back to top
greyvoip at yahoo.com.au
Guest





PostPosted: Wed Feb 13, 2008 10:13 pm    Post subject: [asterisk-users] Asterisk Manager and Visual Basic Reply with quote

----- Original Message ----

Quote:
From: Bill Andersen <andersen at mwdental.com>

Quote:
To: asterisk-users at lists.digium.com

Quote:
Sent: Wednesday, 13 February, 2008 8:31:01 PM

Quote:
Subject: [asterisk-users] Asterisk Manager and Visual Basic

Quote:
Has anyone tried to used VB6 to communicate with the Asterisk Manager?

If so, would you be willing to share some basic code showing your
approach to getting connected and parsing results?

I've got a Telnet control that is allowing me to connect, authenticate
and see the "flow" of status, etc., but I'm sure there is a better way
to do this without using Telnet (maybe not?). Any suggestions?



Hi Bill,

I don't know if it would be of any use to you but we have some C# code that handles the basics of communicating the the Asterisk Manager Interface. It doesn't do anything fancy just sends single commands and checks the responses. We don't use it for monitoring.

Regards,

Greyman.






Get the name you always wanted with the new y7mail email address.
www.yahoo7.com.au/y7mail
Back to top
lee at datatrakpos.com
Guest





PostPosted: Thu Feb 14, 2008 9:49 am    Post subject: [asterisk-users] Asterisk Manager and Visual Basic Reply with quote

Bill Andersen wrote:
Quote:
Has anyone tried to used VB6 to communicate with the Asterisk Manager?

If so, would you be willing to share some basic code showing your
approach to getting connected and parsing results?

I've got a Telnet control that is allowing me to connect, authenticate
and see the "flow" of status, etc., but I'm sure there is a better way
to do this without using Telnet (maybe not?). Any suggestions?

I want to write a presence monitor (a virtual "sidecar" if you will)

Bill


As Razza said, you can just use the winsock control included with VB. The
protocol is very simple, basically just name/value pairs delimited by #13#10
(CRLF) with an extra CRLF at the end to denote termination of the packet.

Action: Originate
Channel: local/111 at Management
Context: to_meetme
Exten: s
Priority: 1
Variable: CALLERID(num)=123432|CALLERID(name)=Automated Call
Async: true
<extra CRLF> <== extra CRLF here.

So, like this:

1. Send your properly formatted packet to AMI .

2. Read incoming response terminated by double #13#10.

3. Parse values as you are comfortable with.

I am in the process of writing a similar product for one of our customers.
Well, a re-write to add features and make it cross platform. Here's a
screenshot running on Linux/GTK:
http://leebo.dreamhosters.com/images/guiApp.png

A couple of side notes from what I've learned myself and read on this mailing
list or through the wiki:

1. Packet Volume
The volume of messages that you can get from the AMI is impressive. I've tested
on our Asterisk system which has only 2 pots lines and two sip trunks with 10
desktop phones and the amount of messages can be staggering!

Use a proxy for AMI if you have any decent phone traffic. AstManProxy is VERY
propular. I wrote one as well, but its still beta and I think there's another
one out there somewhere. Usually with these proxy servers you can filter out
unwanted/extraneous events to reduce the amount of messages your app has to
contend with.

2. Make good use of Observer/Mediator pattern to distribute events to different
parts of your GUI. Monolithic loops to write everything out on a timer's event
or after a Sleep() for instance, is not a good way to go in my experience.

3. Check the source for manager interface for changes between Asterisk 1.2 and
1.4 (and 1.6?) if you're using 1.2 or plan to. I believe the latest version of
AMI is 1.1 (someone can correct me here). A few label names for some of the AMI
packets have been changed and a couple events (like LINK event) have been
changed drastically.

I originally wrote against the 1.2 Manager interface only to find that I had to
refactor some code and write descendant classes to handle the slight differences
between the two versions' events. I could have saved myself some work had I
thought to look for the changes. I think this link is up to date:
http://svn.digium.com/view/asterisk/trunk/doc/manager_1_1.txt?revision=98152&view=markup

Happy coding.
--
Warm Regards,

Lee

"Everything I needed to learn in life, I learned selling encyclopedias door to
door."
Back to top
andersen at mwdental.com
Guest





PostPosted: Thu Feb 14, 2008 11:22 am    Post subject: [asterisk-users] Asterisk Manager and Visual Basic Reply with quote

Quote:
I don't know if it would be of any use to you but we have some C# code
that handles the basics of communicating the the Asterisk Manager
Interface. It doesn't do anything fancy just sends single commands and
checks the responses. We don't use it for monitoring.

Regards,

Greyman.

Thanks for the offer, I think I've got it figured out using winsock.

Thanks again.

Bill
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services