Pages: << 1 ... 4 5 6 7 8 9 10 11 12 13 14 ... 52 >>

12/08/09

Permalink 04:30:18 am, by novecento Email , 586 words   English (US)
Categories: Asterisk

AMI (Asterisk Manager API) with Visual Basic.Net 2008

I'm not sure on how it is for you guys but i somehow did not succeed with the various DLL and API's written for .NET and AMI.

They all seem awfully complex and huge for simple things like checking if a device and /or user is registered in Asterisk.

We are using AMI for our new Intuit sof-tphone which is specially built for larger Asterisk enterprise and call center deployments... but more about our soft-phone on the 17. December 09 launch... :-)

I found some C# sample which was not really working properly, therefore i wrote a couple of lines here in VB which works well...

Imports System.Xml
Imports System.Text
Imports System.Net
Imports System.Net.Sockets
Imports System.Text.RegularExpressions

Sub check_fixedoradhoc()

' adhoc = 1
' fixed = 2

Dim devicestatus As Integer = 0
Dim loginstatus As Integer = 0

Dim clientSocket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim serverEndPoint As New IPEndPoint(IPAddress.Parse(My.Settings.txt_AMI_IP_Address), My.Settings.txt_AMI_Port)
clientSocket.Connect(serverEndPoint)

clientSocket.Send(Encoding.ASCII.GetBytes("Action: Login" & ChrW(13) & ChrW(10) & "Username: admin" & ChrW(13) & ChrW(10) & "Secret: amp111" & ChrW(13) & ChrW(10) & "ActionID: 1" & ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10)))

Dim bytesRead As Integer = 0
Dim bytesRead2 As Integer = 0
Dim bytesRead_userstatus As Integer = 0

' Give some tiem to establish socket connection
' TODO: write if conencted established check !!!

Delay(3)
MsgBox("hello")
Dim buffer As Byte() = New Byte(1024) {}
bytesRead = clientSocket.Receive(buffer)

Dim response As String = Encoding.ASCII.GetString(buffer, 0, bytesRead)

If (Regex.Match(response, "Message: Authentication accepted", RegexOptions.IgnoreCase).Success) Then

Do
'clientSocket.Send(Encoding.ASCII.GetBytes("Action: DBGet" & ChrW(13) & ChrW(10) & "Family: DEVICE" & ChrW(13) & ChrW(10) & "Key: 1000/type" & ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10)))
clientSocket.Send(Encoding.ASCII.GetBytes("Action: DBGet" & ChrW(13) & ChrW(10) & "Family: DEVICE" & ChrW(13) & ChrW(10) & "Key: " & My.Settings.Extension & "/type" & ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10)))
Dim buffer2 As Byte() = New Byte(1024) {}
bytesRead2 = clientSocket.Receive(buffer2)

Dim response2 As String = Encoding.ASCII.GetString(buffer2, 0, bytesRead2)

If (Regex.Match(response2, "Val: adhoc", RegexOptions.IgnoreCase).Success) Then
MsgBox("device status adhoc")
devicestatus = 1
bytesRead2 = 0
End If

Loop While (bytesRead2 <> 0)

Do
'clientSocket.Send(Encoding.ASCII.GetBytes("Action: DBGet" & ChrW(13) & ChrW(10) & "Family: DEVICE" & ChrW(13) & ChrW(10) & "Key: 1000/user" & ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10)))
clientSocket.Send(Encoding.ASCII.GetBytes("Action: DBGet" & ChrW(13) & ChrW(10) & "Family: DEVICE" & ChrW(13) & ChrW(10) & "Key: " & My.Settings.Extension & "/user" & ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10)))
Dim buffer_userstatus As Byte() = New Byte(1024) {}
bytesRead_userstatus = clientSocket.Receive(buffer_userstatus)

Dim response_userstatus As String = Encoding.ASCII.GetString(buffer_userstatus, 0, bytesRead_userstatus)

If (Regex.Match(response_userstatus, "Val: none", RegexOptions.IgnoreCase).Success) Then
MsgBox("user not loged in")
loginstatus = 0
bytesRead_userstatus = 0
End If

If (Regex.Match(response_userstatus, "Val: 1000", RegexOptions.IgnoreCase).Success) Then
MsgBox("user already loged in")
loginstatus = 1
bytesRead_userstatus = 0
End If


Loop While (bytesRead_userstatus <> 0)

End If

If devicestatus = 1 & loginstatus = 0 Then

frm_UserLogin.ShowDialog()

End If

End Sub


This code simply connect to the AMI and checks if a DEVICE is a fixed or adhoc type as well it checks if a User is logged in (if its a adhoc DEVICE).

If no user is logged in the application will prompt the user to login into Asterisk.

This code has no error handling and is quick and dirty. But it should help you starting with AMI and VB.Net 2008.

Cheers
Daniel

Cheers
Daniel

11/19/09

Permalink 04:50:32 pm, by novecento Email , 97 words   English (US)
Categories: News

Reset vtiger admin password

Good Morning

If you have a "birdbrain" like myself you maybe in a situation like me this morning and need to reset a vtiger admin password... :-)

Here is a simply sql query to achieve this:

Login in to mysql cli:

mysql -u root -p

(you need to know your mysql root password...)

then issue this command:

mysql> update vtiger_users set user_hash=’21232f297a57a5a743894a0e4a801fc3′, user_password=’adpexzg3FUZAk’,confirm_password=’adoY/6Mlw8kqg’,crypt_type=” where user_name=’admin’;

and you can login with:

username: admin
password: admin

Cheers
Daniel

11/17/09

Permalink 07:41:00 pm, by novecento Email , 158 words   English (US)
Categories: News, Asterisk

Hello Project in Cambodia

We (Frank and i) are currently in Phnom Penh deploying a Asterisk based call center for Hello, a Axiata owned cell phone provider in Cambodia.

The project is well on the way and tomorrow the call center will be live!!!

Frank is doing some user training and i work on the Hello-Softphone.
It's a cool softphone which we build from scratch for Hello.

It integrates nicely into their backend solution to display things like:

customer name, account number, billing plan (pre or potpaid), birthday etc etc.

The design is a little "yellow" and boxily for my taste, but that's how the client like it :-)

Last night we had a nice dinner in the hotel room. We bought awesome cheese and meats (which we cannot get usually at home in Malaysia)... yummmm

Here some pictures:

If you need a customized,stable, and affordable softphone for your Asterisk deployments call us anytime. :-)

I wish you a great day!

Cheers
Daniel

11/11/09

Permalink 03:46:07 pm, by novecento Email , 774 words   English (US)
Categories: News, Asterisk

DimDim and Asterisk - perfect combination

If you ever look for a cool WebEx replacement then DimDim is a great free and opensource solution for you.

DimDim provides:

- Desktop Sharing
- White Board
- Document Sharing (PPTX, PPT and PDF)
- Website-Sharing
- Chat
- Conference Recording
- Video
- and more... :-)

We use DimDim in combination with Asterisk, where Asterisk provides the audio features (conference bridge) and DimDim provides all web conferencing functionality.

Some pictures:

Install DimDim on Debian 5 (Lenny):

This is a rough guide on how to get DimDim up and running on Debian 5. Some of the content is from help files, and website....

In my case I installed DimDim on one of our demo Asterisk server. Therefore i run DimDim on port 81 and not 80.

Before you can install DimDim you need to install certain prerequisites.

Openoffice.org 3

cd /usr/src
wget http://spout.ussg.indiana.edu/openoffice/stable/3.1.1/OOo_3.1.1_LinuxIntel_install_en-US_deb.tar.gz

Or download the version you need (different language) from here:
http://download.openoffice.org/other.html

tar –xzvf OOo_3.1.1_LinuxIntel_install_en-US_deb.tar.gz
cd ‘name of unpacked directory’/DEBS
dpkg -i *.deb

Java v1.6

apt-get install sun-java6-bin

Now you need to set some environment variables:

echo "JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.12" >> /root/.bashrc
echo "export JAVA_HOME" >> /root/.bashrc

Log out as root and log-in again

echo "PATH=$JAVA_HOME/bin:$PATH" >> /root/.bashrc
echo "export PATH" >> /root/.bashrc

Log out as root and log-in again
key in env and you should see your new environment variables set to:

PATH=/usr/lib/jvm/java-6-sun-1.6.0.12/bin:/bin:.........
JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.12

Install other dependencies:

apt-get install openoffice.org-java-common openoffice.org-headless
apt-get install binutils build-essentialapt-get install gawk
apt-get install python-uno python2.5-dev
apt-get install unzip
apt-get install alien

Python Modules for DimDim
DimDim needs a couple of Python modules:

CherryPy

cd /usr/src
wget http://www.intuitinnovations.com/dimdim/cherypy/CherryPy-3.1.0.zip
unzip CherryPy-3.1.0.zip
cd CherryPy-3.1.0
chmod +x *
python2.5 setup.py install
python2.5
>>>import cherrypy
>>>
Ctrl+D

Flup
cd /usr/src
wget http://www.intuitinnovations.com/dimdim/flup/flup-1.0.tar.gz
tar xvf flup-1.0.tar.gz
cd flup-1.0
chmod +x *
python2.5 ez_setup.py -U setuptools
python2.5 setup.py install
python2.5
>>>import flup
>>>
Ctrl+D

Pycurl
cd /usr/src
wget http://www.intuitinnovations.com/dimdim/curl/curl-7.19.0.tar.gz
tar xvf curl-7.19.0.tar.gz
cd curl-7.19.0
./configure
make
make install
ln -s /usr/local/lib/libcurl.so.4 /usr/lib/libcurl.so.4
easy_install-2.5 pycurl
cd ..
python2.5
>>>import pycurl
>>>
Ctrl+D

demjson

cd /usr/src
wget http://www.intuitinnovations.com/dimdim/demjson/demjson-1.3.tar.gz
tar xvf demjson-1.3.tar.gz
cd demjson-1.3
chmod +x *
python2.5 setup.py install
python2.5
>>>import demjson
>>>
Ctrl+D

Download DimDim:

cd /usr/src
Wget http://downloads.sourceforge.net/project/dimdim/Dimdim%20v4.5%20Release/Dimdim%20Cent%20OS%205.2%20RPM%20Package%20v4.5/Dimdim_RPM_Package_CentOS_5.2_v4.5.zip?use_mirror=nchc

unzip Dimdim_RPM_Package_CentOS_5.2_v4.5.zip

cd Dimdim_RPM_Package_v4.5/
alien Dimdim-4.5_SF_i386.rpm
dpkg -i dimdim_4.5-2_i386.deb
mv /usr/local/dimdim-4.5/ /usr/local/dimdim
cd /usr/local/dimdim/
tar xvf CobrowsingManager.tar.gz

Changes of execution rights:

chmod +x /usr/local/dimdim/Mediaserver/mods/*
chmod +x /usr/local/dimdim/Mediaserver/www/pages/*
chmod +x /usr/bin/*
chmod +x /usr/lib/*
chmod +x /usr/local/share/*
chmod +x CobrowsingManager/cob/*
chmod +x StartDimdim.sh
chmod +x StopDimdim.sh
chmod +x Config-ipaddress.pl
chmod +x /usr/local/dimdim/ConferenceServer/apache-tomcat-5.5.17/bin/*
chmod +x /usr/local/dimdim/red5/*
chmod +x /usr/local/dimdim/red5/conf/*
chmod +x /usr/local/dimdim/nginx/sbin/*
chmod +x /usr/local/dimdim/DTP3/Reflector/*

File modifications:

nano /usr/local/dimdim/Mediaserver/mods/toolkit/osconfig.py
replace : return os.path.dirname('/opt/openoffice.org2.4/program/')
with : return os.path.dirname('/opt/openoffice.org3/program/')

nano /usr/local/dimdim/ConferenceServer/apache-tomcat-5.5.17/conf/wrapper.conf
replace : wrapper.java.command=DIMDIM_JAVA_HOME/bin/java
with : wrapper.java.command=/usr/lib/jvm/java-6-sun-1.6.0.12/bin/java

nano /usr/local/dimdim/ConferenceServer/apache-tomcat-5.5.17/conf/server.xml
replace : with :

nano /usr/local/dimdim/StopDimdim.sh
replace : cd /usr/local/dimdim-4.5/ConferenceServer/apache-tomcat-5.5.17/bin/
with : cd /usr/local/dimdim/ConferenceServer/apache-tomcat-5.5.17/bin/

nano /usr/local/dimdim/StartDimdim.sh
replace : cd /usr/local/dimdim-4.5/ConferenceServer/apache-tomcat-5.5.17/bin/
with : cd /usr/local/dimdim/ConferenceServer/apache-tomcat-5.5.17/bin/

nano /usr/local/dimdim/Mediaserver/mods/interface.py
replace : #!/usr/bin/python2
with : #!/usr/bin/python2.5

nano /usr/local/dimdim/CobrowsingManager/cob/startCobServer.sh
replace : /usr/local/bin/python2.5
with : /usr/bin/python2.5

Some other steps:
ln -s /usr/lib/libpcre.so.3 /usr/lib/libpcre.so.0
cp Mediaserver/mods/spawn-fcgi DTP3/Reflector/spawn-fcgi

Check the binaries of openoffice:
ls -l /usr/bin/so*

you should only see this line:
lrwxrwxrwx 1 root root 40 nov 27 13:04 /usr/bin/soffice.bin -> /opt/openoffice.org3/program/soffice.bin

If you see this line to:
lrwxrwxrwx 1 root root 40 nov 27 13:04 /usr/bin/soffice -> /opt/openoffice.or.........
You need to delete:

rm /usr/bin/soffice

and key in this command:

ln -s /opt/openoffice.org3/program/soffice.bin /usr/bin/soffice.bin

then:

cd ThirdPartyPackages/
tar xvf swftools.tar.gz
cp swftools/swfdump /usr/bin/
cp swftools/swfextract /usr/bin/
cp swftools/pdf2swf /usr/bin/
cp swftools/libs/* /usr/lib/
cp -r swftools/swffonts/fonts/ /usr/local/share/swftools/

Then use the ip configuration tool:

Network without firewall/internal : ./Config-ipaddress.pl 192.168.1.2 80 (internal-ip, port)

Firewall : ./Config-ipaddress.pl http://url 80 192.168.1.2 (url external, port, internal-ip)

Open port:80 et 1935 on your firewall.

Point your browser to yourdimdimip and you should see the DimDim login screen.

Cheers
Daniel

11/10/09

Permalink 06:05:03 am, by novecento Email , 166 words   English (US)
Categories: News, Asterisk

Skype to Asterisk - Asterisk to Skype

Tonight in finally got around to install the Skype channel driver for Asterisk.
And i have to say its simply awesome! :-)

Since Digium recommends Asterisk 1.4.25 as minimum version i had to upgrade our 1.4.22. What went without any issues except our IAX2 trunks and extensions where not working anymore...

you need to set:
requirecalltoken=no

in your iax_additional.conf (one each extension) or use FreePBX 2.6 under Tools /
Asterisk IAX Settings you can define:

Please be aware that only Skype users created via Skype BCD (Business Control Panel / http://www.skype.com/intl/en/business/ ) can be used as Asterisk-Skype user.

A Skype BCD user can call any Skype user and any Skype user can call any Skype Business user. A normal Skype user cannot login via Asterisk Skype Channel Driver, but we can call other non business normal skype users (of course!)

If you plan to use Skype with Asterisk, just call Intuit and we get it done for you... :-)

Cheers and enjoy the evening!
Daniel

<< 1 ... 4 5 6 7 8 9 10 11 12 13 14 ... 52 >>