quinta-feira, julho 22, 2010

Resolving hangup detection problems with fxo cards x100p or a digium tdm400p

Resolving hangup detection problems with fxo cards x100p or a digium tdm400p: "Resolving hangup detection problems with fxo cards x100p or a digium tdm400p"

When installing zaptel pstn cards, such as the x100p or a digium tdm400p card with fxo module(s), very often problems occur with hangups of the zaptel end not being detected by asterisk.

For example:

You are using zaptel to dial in into your asterisk server, noone is there, you hit voicemail, you leave a message and hangup the phone.

When you listen to the recordings of the answering machine, you notice a very large recording, asterisk kept the line open for hours and hours.

A common approach is to go have a look at voicemail and see what is going on, force it to hangup after some seconds of silence etc etc.

This is not a good approach as in most cases the problem is not only with voicemail but with any call with at least 1 zap leg. (although it doesnt show up as often on a ZAP to SIP call as normally at the end of a conversation both ends will hangup, and the sip bye will go through, ending both call legs).

Possible Solutions: ordered by recommendation - higher is better

1) Try reverse polarity (cvs-head only, dates after 17nov '04 - bug here )

If your asterisk version is recent enough (and you did a make samples) you should see the following in zapata.conf:

; In some countries, a polarity reversal is used to signal the disconnect
; of a phone line. If the hanguponpolarityswitch option is selected, the
; call will be considered "hung up" on a polarity reversal

If you now uncomment this hanguponpolarityswitch line, and your pstn line uses polarity reversal, asterisk should detect it and hangup the line.
This solution is by far the best, as it will not get you false hangups and will hangup in 100% of the calls.

If you want to see if this might work, you might want to try to load the wctdm kernel module with the debug=1 parameter. (insmod wctdm debug=1) and look for reverse polarity messages on the console).

You might want to try this option if you enabled the fxs Kewlstart signalling in zapata.conf

2) Go fix your location in zapata.conf

By default, asterisk listens for a busy tone or a a dial tone on the line to detect if the line got hung up.

These tones are different in different countries, duration and tones might differ a little between carriers.

The definitions of these indications can be found in /etc/asterisk/indications.conf
Try to find your country in the list, if its there, go look at /etc/asterisk/zapata.conf

; On trunk interfaces (FXS) and E&M interfaces (E&M, Wink, Feature Group D
; etc, it can be useful to perform busy detection either in an effort to
; detect hangup or for detecting busies
; On trunk interfaces (FXS) it can be useful to attempt to follow the progress
; of a call through RINGING, BUSY, and ANSWERING. If turned on, call
; progress attempts to determine answer, busy, and ringing on phone lines.
; This feature is HIGHLY EXPERIMENTAL and can easily detect false answers,
; so don't count on it being very accurate. Also, it is ONLY configured for
; standard U.S. tones

Lets explain what those 3 options mean:

With this option enabled, asterisk will try to 'listen' for busy signals on the line, if your carrier sends you a busy tone on a hangup, this should detect it. (Note that this is not exact science, asterisk might think your cat screaming is a busy tone and hangup. In case of loopstart in zapata.conf, you will certainly need this.

To avoid this, they invented the next option,

Busycount defines the amount of busy tones asterisk needs to recognize before actually considering the line to really really give a busy tone, to avoid false hangups on non hangup sounds.
The standard setting is 3, but you could change that to 6 or 10 if you would want to.

A side effect is, that it will take longer to detect a hangup and in case of a real hangup, the line will stay occupied for a little longer than with a lower value of busycount.

This option is similar to the busydetect option, but will also listen for a ringing tone, congestion tone and will try to detect if the line got answered.
It might work for you, but its highly unreliable and will probably give many false hangups.

Please note that none of these 3 options should be activated on digital zaptel channels, (BRI, PRI) as they will not help with anything, they will just cause false hangups).

When you get the reverse polarity to work, dont use these options either.

3) Check your signalling settings in zapata.conf:

; fxs_ls: FXS (Loop Start)
; fxs_gs: FXS (Ground Start)
; fxs_ks: FXS (Kewl Start)


The correct choice for the signalling= line depends on your carrier.
When you call them with this question they probably wont have a clue what you are talking about so trying several might be a good idea.

Kewl start is the best option there is, but it might not work in your situation, try to call your telco and ask for "disconnect supervision"
In this case, the telco will cut the power on the 2 telephone lines for a small period of time or will reverse the polarity on the lines.

(You could check this by calling to that pstn line, and connecting a phone with a lighted keypad and without external power supply there).
If the lights go out when the other end disconnects, the telco has disconnect supervision.

Loop start does not send a hangup signal, you will need the busydetect parameter.

I dont know if you need extra options with Ground start signalling, i never tried it myself. Let us know if you know.

4) Sell your x100p or clone on ebay or feed it to the dogs, and buy a real TDM card, like the tdm400p.

The x100p's are not very good with the hangups or with callerids.

5) Buy a device like : this device

sexta-feira, julho 16, 2010

How to unlock SIP / Voip on your Nokia N97

How to setup voip (sip client) on nokia phone enables
WINK Streaming - How to unlock SIP / Voip on your Nokia N97: "History

Nokia indicated that SIP would be enabled on N97 phones with the release of v20 firmware, a feature that was expected to be delivered by many users. With no sip in v20 a few users on the Nokia discussion board took matters into their own hands and tried everything possible to get things working. The result is a perfectly working SIP client that works on WIFI and 3G.
THIS WILL ONLY WORK FOR N97's with v20 Firmware OR NET SETTINGS already installed !!

While not tested, it is possible that this solution may work on other Nokia Phones (n96, 5800, N97 mini, etc.) that have SIP Settings ( Settings / Connectivity / Admin Settings / SIP Settings) Menu, but do not have SIP enabled as is the case with the N97.

Special thanks to techman29, miniMAXIME, MickJT and vishaldesai823 over at discussions.europe.nokia.com for helping come up with this patch.
UPDATE: Nokia has finally released the final version - the download below is now this official package SIP_VoIP_3_1_Settings_S60_5_x_v1_0_en.sis. The functionality appears to be no different.

Special Considerations

* When you Dial from your Contact List if there is a + infront of the number you are dialing, you may not be able to complete your call. Your VoIP provider might not be able to handle this, so to test your installation use the Dial Pad, then hit Options > Internet Call. That will best let you know if you have any issues.

* Once you have things installed and working you can add contacts from your contact book under your SIP profile - Just select Options / New Contact / Add From Contacts. This is useful for keeping track of people you might call using SIP.

* There are many advanced settings that are available to you that will allow you to tweak things to get SIP working in the manner you like. While most of the data in the documentation is not valid for the N97, it should give you an idea of what is available and what it does. You can get the PDF from Nokia here:SIP_VoIP_Release_3_x_Settings_Application_User_Guide_v2_0_en.pdf


Here is how to get the best possible experience of running VoIP on your N97 with what is currently available from Nokia, of course with a few hacks and such. Hopefully when Nokia comes around to releasing an official package there will be more features available - but until then this is how to get SIP working optimally.

Remove the old applications
Settings / Application mgr. / Installed Apps
Remove anything you may have installed. In the app manger under installed apps look for 'InternetAdvSetting' or anything that begins with 'SipSettings*' etc. Get rid of them both.

Install 'InternetAdvSettings' by Nokia
You can download the file here.
This file has been extracted from the latest 'SIP_VoIP_3_x_Settings_v2_0_en.sis'. This original file will not work as a standalone installer - but one of the parts within it solves the issues, we have supplied the extracted part for you.

* Download the file above or click here
* Extract 'sis' installer from the ZIP file
* Install the SIS File on your Phone (it is SIGNED by NOKIA so it is SAFE)
* When you get a message that says the App is incompatible with your phone - Hit Continue as this is not true, it works just fine. You should however not see this error anymore.
* You should now have a new ICON called 'Advanced VoIP' under Settings / Connectivity / Admin Settings / Net Settings

Create your SIP profile
Settings / Connectivity / Admin Settings / Sip Settings / New Sip Profile
Name your Profile something you like, such as 'VOIP' - this will be the name it shows up under contacts. For example if you named it 'VOIP' when under a contact it will display as 'VOIP Call'. For a typical install see the bottom of this page. Set the Transport Type to UDP if calls are not working over 3G !

Create a VoIP Service
Settings / Connectivity / Admin Settings / Net Settings / Advanced VoIP settings / Create new Serivce
In order to actually use the SIP profile created in Step 3 you must Create a VoIP service. To do this select 'Create new service' and then select the Profile you created in Step 2. This will add a new item under 'Net settings' if you named your profile 'VoIP' it will show up as 'VoIP Sett'.

Adjust your Codecs
Connectivity / Admin Settings / Net Settings / Advanced VoIP settings / Voip Servies / / Codecs /
If you know that your SIP provider supports G.729 then move that codec up to be #1 in the list - this should be self explanitory. If you don't know what you are doing, skip this step!

Enable SIP over 3G
Connectivity / Admin Settings / Net Settings / Advanced VoIP settings / Voip Services / / Profile settings
To enable SIP Calls over 3G set both 'AWCDMA' and 'UAWMAC' to ON. Note that you will be charged for data when using 3G - and your phone should warn you when doing so.

Make SIP Calls look pretty in your Call Log
Connectivity / Admin Settings / Net Settings / Advanced VoIP settings / Voip Services / / Profile settings
If you only want to see the callers number in your Call Log you can set a parameter that will strip the domain name out of the number calling you. Say the number (555) 123-4545 calls you on your SIP line:

Ignoring Domain Part: ON - the number will show as 5551234545
Ignoring Domain Part: OFF - the number will show as 5551234545@sip.example.com

The problem is if you have 'Ignoring Domain Part = Off' it is impossible to call back from say your mobile number or add the number to your address book. For that reason it is best to set this to ON.

Prevent your SIP Client from TIMING OUT with the Server (STUN Server)
If you notice that after a few minutes and you can no longer receive calls you likely have a timeout issue. This can be fixed by using advanced settings and setting up a STUN server.
Connectivity / Net Settings / Advanced VoIP settings / NAT Firewall Settings

* Open Domain parameters, then select your SIP server domain, it should be there.

* STUN Settings (for a list of public servers google 'public stun servers')
STUN server: ex. stunserver.org
Port: 3478 (or whatever your server uses)
Username: (blank)
Password: (blank)
Shared Secret: Off
Start Port: 49152
End Port: 65535

* TCP NAT bind refresh timer:1200

* UDP NAT bind refresh timer:28

* CRLF refresh: ON

How to Start and Stop VoIP Service
Contacts / Globe Icon
To start or stop the SIP service enter contacts then see the newly created Globe Icon - select your SIP user name, hit 'Options' and either log in or log out. When the service is connected to the SIP Server you will see a phone sitting on top of a globe up on the status bar.

Setting up your SIP Profile

The following is how to set up your SIP profile. If you have the service running, you must stop it in order to modify it this can be done following bullet #9 above.

Settings / Connectivity / Admin Settings / SIP Settings / Options / New SIP Profile

Profile Name: VoIP (Or whatever you choose to call it)
Service profile: IETF
Default Destination: (Choose what ever is applicable to you such as 'Internet')
Public user name: sip:@
Use compression: No
Registration: When Needed (or whatever you like)
Use security: No

Proxy server (you might not need this - or you might. Try without first)
Proxy server address: None
Realm: (IP Address to Server)
User name: (Your SIP number)
Password: (Your password)
Allow loose routing: Yes
Transport type: Auto (If SIP is not working over 3G try UDP )
Port: 5060

Registrar Server
Registrar server address: sip: (ex. sip.example.com)
Realm: (IP Address to Server)
User name: (Your sip login or number)
Password: (Your password)
Transport type: Auto (If SIP is not working over 3G try UDP )
Port: 5060

Good Luck!

- Sent using Google Toolbar"

terça-feira, julho 13, 2010

Audacity: Free Audio Editor and Recorder

Audacity: Free Audio Editor and Recorder
Audacity® is free, open source software for recording and editing sounds. It is available for Mac OS X, Microsoft Windows, GNU/Linux, and other operating systems. Learn more about Audacity... Also check our Wiki and Forum for more information.
wave editor

domingo, julho 11, 2010

DAHDI Modules in FC11

That seems to work on fedora core 11.
Download latest dahdi-linux from http://downloads.asterisk.org/pub/telephony/dahdi-linux/

Follow theses instructions and have the modules...


yum -y install dahdi-tools kernel-devel kernel-headers
Then after that try the normal:
cd dahdi-linux*
make distclean
make install all
I could be wrong on that last part, but the instructions for it are in the readme in the packages folder.

sábado, julho 03, 2010

How to setup a mySQL (DSN) datasbase source in CentOS with myODBC and unixODBC command line. | webAJ.com

How to setup a mySQL (DSN) datasbase source in CentOS with myODBC and unixODBC command line. | webAJ.com




How to setup a mySQL (DSN) datasbase source in CentOS with myODBC and unixODBC command line.

Setup guide is using the same hardware and CentOS install we used in our prior how to on Zenoss. I use the Zenoss database on the localhost but this can easly be changed for setting up a ODBC connection on a remote host machines useing any database.

This entire install process is done as root, so login to your server and lets get started.
Install myODBC and unixODBC as a dependency.
yum install mysql-connector-odbc

Dependencies Resolved
Package Arch Version Repository Size
mysql-connector-odbc i386 3.51.12-2.2 base 142 k
Installing for dependencies:
unixODBC i386 2.2.11-7.1 base 832 k

Transaction Summary
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 973 k
Is this ok [y/N]:

Print your config infomation.
odbcinst -j
unixODBC 2.2.11
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /root/.odbc.ini

Edit /etc/odbc.inst and /etc/odbcinst.ini
Below are my examples.
vi /etc/odbcinst.ini

Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc.so
Setup = /usr/lib/libodbcmyS.so
UsageCount = 2

[MySQL ODBC 3.51 Driver]
Description = ODBC 3.51 for MySQL
DRIVER = /usr/lib/libmyodbc3.so
SETUP = /usr/lib/libmyodbc3S.so
UsageCount = 2

vi /etc/odbc.inst
Driver = /usr/lib/libmyodbc3.so
SERVER = localhost
PORT = 3306
DATABASE = events
USER = root

Note: The PASSWORD: is the one we setup during our Zenoss installation and is REQUIRED because Splunk uses it to authenticate to the database.

Once you create your files and save them here is how you do the install.
Install driver
odbcinst -i -d -f /etc/odbcinst.ini

Install system DSN
odbcinst -i -s -l -f /etc/odbc.ini

Test your DSN install by lisinting your installed data sources.
odbcinst -s -q

Test that you can connect to the database via the ODBC.
isql -v zenoss root BlAh
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
SQL> quit
You are done. Here are some quick and dirty ways to fix some problem I had during the install.
I did not have libtool installed properly.
Install libtool
yum install libtool
edit lb.so.conf

Before the include I added
/opt/splunk/lib <---- I later commented this out.

Load the new ld.so.conf
ldconfig (you will not recive any confermation)

I also had a problem acidently loading user DSN so you can remove the user odbc.ini file or copy the one from /etc to the profile.
rm /home/name/.odbc.ini

How to remove a driver.
odbcinst -u -d -n zenoss
zenoss has been deleted (if it existed at all) because its usage count became zero.

How to remove a datasource.
odbcinst -u -s -l -n zenoss
odbcinst: DSN removed (if it existed at all). ODBC_BOTH_DSN was used as the search path.

Remeber if you change a odbc peramerter you need to install it again.
odbcinst -i -s -l -f /etc/odbc.ini
My next article will be how to setup Splunk to use the Zenoss myODBC connection as a datasource.

quinta-feira, julho 01, 2010

Asterisk cmd Queue - voip-info.org

Asterisk cmd Queue - voip-info.org

Very usefull. How to work with queues using asterisk


Asterisk 1.6.0:

Asterisk 1.4:

Asterisk 1.0 through 1.2:

Queues an incoming call in a particular call queue as defined in queues.conf or dynamic realtime.

The option string may contain zero or more of the following characters:
  • d — data-quality (modem) call (minimum delay).
  • h — allow callee to hang up by pressing *.
  • H — allow caller to hang up by pressing *.
  • n — no retries on the timeout; will exit this application and go to the next step.
  • r — ring instead of playing MOH.
  • R — stops moh and rings once an agent is ringing (Asterisk Trunk)
  • t — allow the called user to transfer the calling user.
  • T — allow the calling user to transfer the call.
  • w — allow the called user to write the conversation to disk via Monitor.
  • W — allow the calling user to write the conversation to disk via Monitor.
  • c — continue in the dialplan if the callee hangs up (Asterisk 1.6.0 and above).
  • i — ignore call forward requests from queue members and do nothing when they are requested (Asterisk 1.6.0 and above).
  • k — Allow the called party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf (Asterisk 1.6.0 and above).
  • K — Allow the calling party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf (Asterisk 1.6.0 and above).
  • x — allow the called user to write the conversation to disk via MixMonitor (Asterisk 1.6.0 and above).
  • X — allow the calling user to write the conversation to disk via MixMonitor (Asterisk 1.6.0 and above).

In addition to transferring the call, a call may be parked and then picked up by another user.

'URL' allows you to specify a URL that will be sent to the called party if the channel supports it. You can also use an external application like QueueMetrics or Asteria Solutions Agent Client to launch the URL if your terminal does not support it.

  • In Asterisk 1.4, the optional AGI parameter will setup an AGI script to be executed on the calling party's channel once they are connected to a queue member.

'announceoverride' allows you to override the announcement specified in queues.conf using 'announce = ...' or add one to it in the first place.

'timeout' sets the time in seconds that a call will wait in the queue before it is routed to the next priority in the dialplan. It defaults to 300 seconds (5 minutes).

The timeout will cause the queue to fail out after a specified number of seconds, checked between each queues.conf 'timeout' and 'retry' cycle.
This application sets the following channel variable upon completion:

Note: This doesn't do what you think it should do (in 1.2.4 anyway). Once a call is inside a queue, it is only checked to see if it is timed out every so often (depending on the value of 'timeout=' for that queue in queues.conf). This means that if queues.conf says 'timeout=10' and you call the queue with 'Queue(queuename,,,,5)', it will be ten seconds before the call times out. If you call the Queue with 'Queue(queuename,,,,11)', it'll be 20 seconds. I.E. the value of 'timeout' supplied to the command DOES NOT override the value of 'timeout=' in queues.conf. Don't think about changing the value of 'timeout=' in queues.conf to, say, 1 or the calls will get offered to the members for only one second at a time.

This article attempts to explain this behavior. Note that this article states that the value of the 'timeout' parameter is absolute, which is not correct.

New in Asterisk 1.4: The MEMBERINTERFACE channel variable holds information about which queue member received the call. Variable is not available until you set 'setinterfacevar=' to 'yes' in queues.conf.
Note: This parameter must be wrote INSIDE of each queue, not in the general context because it won't work.

Return codes

This application returns -1 if the originating channel hangs up, or if the call is bridged and either of the parties in the bridge terminate the call. Returns 0 if the queue is full, nonexistent, or has no members.

This method only works when there are no members defined in queues.conf, and instead only added with AddQueueMember(). However with "Member => Agent/101" in queues.conf the Queue command always returns as if there were a member.
Update: 'leavewhenempty = yes' in queues.conf fixes this (in CVS since Sep 28, 2004)


  • If 'persistentmembers = yes' is used in queues.conf, dynamically added agents are saved in the Asterisk Berkeley database, and are preserved across restart. If not, dynamically added agents are lost upon Asterisk restart.
  • Use the 'Local' channel construct to point to an appropriate dial-out extension in the dialplan if you'd like to add remote agents using AgentCallbackLogin()
  • Transfers of calls that are answered out of a queue must be done using Asterisk '#' transfers (enabled with the 't' option above). SIP transfers result in the Agent remaining affiliated with the call until its eventual termination, preventing that agent from being offered another call.
  • The application sets the following channel variable upon completion: QUEUESTATUS. The status of the call as a text string, one of TIMEOUT, FULL, JOINEMPTY, LEAVEEMPTY, JOINUNAVAIL, or LEAVEUNAVAIL.
  • A member assigned to a queue ("member => Agent/1234" for example) can be a phone (e.g. "member => SIP/phone1").
  • Check the timeout settings of your extensions involved in the queue.
  • Snom Phones have in their web interface an "invisible" timeout of 60 seconds. The Playback command, even if an empty file is played, seems to help in avoiding a call being dropped after 60 seconds.


Example 1: Basics

exten => s,1,Answer
exten => s,2,SetMusicOnHold(default)
exten => s,3,DigitTimeout,5
exten => s,4,ResponseTimeout,10
exten => s,5,Background(welcome)
exten => s,6,Queue(tech-queue)

The s,1,Answer is important in order not to have ringing in the background of your hold music.

Example 2: Use BLF LED to show queue login status of an agent

Look at this post (in German), requires bristuff'ed Asterisk 1.2 or 1.4

Example 3

Here is a working queue-solution as example:

A call comes in over a sip channel, is routed to the extension which handles the example-queue (here extension 129) in the context example-queue in extensions.conf. The call, if not answered by an agent, should remain for 300 seconds in the queue, before it is routed to the next priority which transfers the call to voicemail.
The called and the calling user are able to transfer the call (tT as options of the queue command in extensions.conf).

Signaling the call to logged on agents should work like this:

After the first priority "Playback(some_announce)" has finished, all agents should be signalled (ringall in queues.conf) for at least 15 seconds (timeout in queues.conf). The caller should hear music on hold in the meanwhile. If the call wasn't answered by an agent, there should be some time before the call is signalled again (retry in queues.conf). The actual queue position is announced to the caller every 30 seconds (announce-frequency and announce-holdtime in queues.conf).


exten => 129,1,Playback(some_announce) ; Important, see notes
exten => 129,2,Queue(example_queue|tT|||300) ;dont set n option until really needed
exten => 129,3,Playback(some_announce_after_leaving_queue)
exten => 129,4,Voicemail(s1234)


music = default
strategy = ringall
context = queue-out ; Here we go when the caller presses a single digit, while in the queue
timeout = 15
announce-frequency = 30
announce-holdtime = yes
joinempty = yes
member => Agent/1234
member => Agent/1235


ackcall=no ; Agent does NOT have to press # to answer the call
musiconhold => default
agent => 1234,0000,Agent1_Name
agent => 1235,0000,Agent2_Name

See also

  • Function QUEUE_MEMBER_COUNT: Count number of members answering a queue
  • Function QUEUE_MEMBER_LIST: Returns a comma-separated list of members associated with the specified queue
  • Function QUEUE_WAITING_COUNT: Count number of calls currently waiting in a queue
  • Asterisk call queues
  • Asterisk config queues.conf
  • Applications used: Answer | SetMusicOnHold | DigitTimeout | ResponseTimeout | Background
  • Asterisk RealTime Queue, to store queues in a database with automatic update of changes (no need for explicit reload).
  • Asterisk agents
  • Asterisk Queue Callback - Dialplan and Perl script to allow your callers to hang up without losing their place in the queue.
  • Function DIALGROUP: New in 1.6: Poor man's calling queue
  • Queue-Tip - Opensource (GPL) Asterisk Queue Monitoring and Reporting suite using Adhearsion and Ruby on Rails.
  • OrderlyQ - Extension to Asterisk Queues that lets callers hang up, then call back without losing their place.
  • OrderlyStats - FREE Dedicated Real Time Call Centre Management and Statistics Package.
  • app_icd: Look at ICD if you desire a more customizable queue and call center solution
  • IPSwitchBoard BETA - Queue Log Analyzer
  • QueueMetrics is a software package to analyze the queue_log file and extract a wealth of aggregate statistics on queue activities. The software is available for download and public trial.
  • Asteriskguru Queue Statistics - The Asteriskguru queue statistics, is a PHP based program, which gives anyone who uses queues or CDRs overview in Asterisk a deep insight in the quality of the service which is delivered to their customers.
  • AstQueueIcon: Alternative free queue solution utilitzing the call parking feature instead of the queue application. As the queue app stays out of the media path, features like call forwarding will not be denied for the agents.
  • Asterisk Queues Tutorial (from Orderly Software).
  • 1.6.x Patch to add ringing: Adds optional support for giving ringing indication when the queue finds a member/agent to call. (as opposed to always playing MOH)