-
Jan 2nd, 2017, 11:18 AM
#1
Thread Starter
Hyperactive Member
VB.NET and AsterNet
Hi guys,
Does anyone here know anything about AsterNet (.NET for Asterisk) ?
Thanks
-
Jan 2nd, 2017, 09:40 PM
#2
Re: VB.NET and AsterNet
Rather than asking whether anyone knows anything, you should probably explain what it is that you actually want to do and then you can find out whether anyone knows that specifically.
-
Jan 3rd, 2017, 10:22 AM
#3
Thread Starter
Hyperactive Member
Re: VB.NET and AsterNet
Originally Posted by jmcilhinney
Rather than asking whether anyone knows anything, you should probably explain what it is that you actually want to do and then you can find out whether anyone knows that specifically.
Good idea...
So here is what I'm trying to do
1. Connect to my Asterisk
2. Pull a list of all "Registered" extensions
3. Get labels for each extension (automatically added) so I will not need to modify the code for each new extension
I managed to connect with no problem, here is my code:
Code:
Imports AsterNET
Imports AsterNET.Manager
Imports AsterNET.Manager.Event
Imports AsterNET.FastAGI.Command
Imports AsterNET.FastAGI
Imports AsterNET.IO
Imports System.Text
Imports System.Data.Sql
Public Class Form1
Dim host As String = "192.168.1.2"
Dim port As Short = 5038
Dim user As String = "AMIuser"
Dim pass As String = "password"
Dim conn As New ManagerConnection(host, port, user, pass)
Dim exten As Short
Dim state As String = "state"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label1.Text = state
Logoffbtn.Enabled = False
End Sub
Private Sub Loginbtn_Click(sender As Object, e As EventArgs) Handles Loginbtn.Click
Try
conn.Login()
Catch ex As Exception
MsgBox("Error logging on")
End Try
Label1.Text = conn.IsConnected
If Label1.Text = "True" Then
Loginbtn.Enabled = False
Logoffbtn.Enabled = True
End If
End Sub
Private Sub Logoffbtn_Click(sender As Object, e As EventArgs) Handles Logoffbtn.Click
Try
conn.Logoff()
Catch ex As Exception
MsgBox("Error logging off")
End Try
Label1.Text = conn.IsConnected
If Label1.Text = "False" Then
Loginbtn.Enabled = True
Logoffbtn.Enabled = False
End If
End Sub
But after that, I can't figure it out...
I have a ListBox that I need to fill with the "Registered" extensions
And for every line in the ListBox it needs to generate a label (this I didn't figure out also)
Thanks for any help I can get...
-
Apr 26th, 2017, 11:12 AM
#4
New Member
Re: VB.NET and AsterNet
Hello, did you solve the question?
I'm trying to receive the events from asterisk just now with no result.
Can you help me?
Thanks!
-
Apr 26th, 2017, 12:30 PM
#5
Thread Starter
Hyperactive Member
Re: VB.NET and AsterNet
Originally Posted by jajiro
Hello, did you solve the question?
I'm trying to receive the events from asterisk just now with no result.
Can you help me?
Thanks!
Hi,
No, I did not solve it
but what are you trying to do?
-
Apr 26th, 2017, 12:47 PM
#6
New Member
Re: VB.NET and AsterNet
Originally Posted by threeeye
Hi,
No, I did not solve it
but what are you trying to do?
Hi,
I'm trying to connect with the asterisk server and receive data from VoIP calls.
At then moment I can connect and disconect but I don't know how can I receibe information about the received calls (the number, duration, ...)
I think that my problem is about catch the events but i'm lossing
Thanks for your help.
-
Apr 27th, 2017, 12:15 PM
#7
New Member
-
Apr 28th, 2017, 03:57 AM
#8
Re: VB.NET and AsterNet
i have got no idea about this stuff but just googled ManagerConnection and found this: https://maven.reucon.com/projects/pu...onnection.html
It suggests that you Need to call addEventListener(ManagerEventListener eventListener)
so i'd start off adding a new class inheriting from ManagerEventListener overriding onManagerEvent and call addEventListener with this class.
-
Apr 28th, 2017, 05:24 AM
#9
New Member
Re: VB.NET and AsterNet
Thanks four your help, now I can receive de NewState event. Now Im trying to make a call but I receive the responde "Extension does not exists".
This is the code:
Private WithEvents Manager As New AsterNET.Manager.ManagerConnection(host, port, user, pass)
...
Manager.Login()
Dim test As New Action.OriginateAction
Manager.UseASyncEvents = True
test.Server = host
test.Channel = "PJSIP/trunk_2-000000f4"
test.CallerId = "Test"
test.Exten = "123456789" ' Phone number
test.Priority = 1
test.Context = "default"
test.Timeout = 30000
test.Async = True
Dim originateResponse As ManagerResponse = Nothing
originateResponse = Manager.SendAction(test, 30000)
? donĀ“t know why that extension does not exists because if I call to the VoIP server, in the NesState event, the property e.Channel is the same.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|