Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7758591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:24:00+00:00 2026-06-01T13:24:00+00:00

I’m currently working on a project ’email to voice call’. Using python i’v extracted

  • 0

I’m currently working on a project ’email to voice call’. Using python i’v extracted the email & converted it into speech and saved in a WAV file. Now using asterisk (I’v installed Asterisk 10.2.1 on my ubuntu 10.10 os) i want to generate call to the cell phone (say 919833000000 india’s no.) of the user through my system.

I have written a python code to connect to asterisk manager interface. Also i have configured the sip.conf and extensions.conf files as well as manager.conf. I have registered with voip provider voiceall.com and have a username password of it.

Now when i’m executing the python code, the code is getting executed without any error but nothing is happening. No call is getting generated. Can anyone help me out with this.
The python code is as below:

import sys, os, socket, random
# Asterisk Manager connection details
HOST = '127.0.0.1'
PORT = 5038
# Asterisk Manager username and password
USER = 'MYUSERNAME'
SECRET = 'MYPASSWORD'
# Set the name of the SIP trunk to use for outbound calls
TRUNK = 'voiceall'



OUTBOUND = '919833000000'

# Send the call details to the Asteirsk Manager Interface
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
sleep(3)
s.send('Action: login\r\n')
s.send('Username: ' + USER + '\r\n')
s.send('Secret: ' + SECRET + '\r\n\r\n')
sleep(3)
s.send('Action: status\r\n')
data = s.recv(1024)
print data + '\n'
s.send('Events: off\r\n\r\n')
sleep(3)
s.send('Action: originate\r\n')
s.send('Channel: Sip/' + TRUNK + '/' + OUTBOUND + '\r\n')
s.send('WaitTime: 30\r\n')
s.send('CallerId: VOICEALL_USERNAME\r\n')
s.send('Application: playback\r\n')
s.send('Data: /home/Documents/newdemo1' + '\r\n')  #newdemo1 is the wave file
s.send('Context: testing\r\n')
s.send('Async: true\r\n')
s.send('Priority: 1\r\n\r\n')
sleep(10)
s.send('Action: Logoff\r\n\r\n')
s.close()

My sip.conf file is as below:

[general]                
register => VOICEALL_USERNAME:VOICEALL_PASSWORD@sip.voiceall.net:5038

[voiceall]
canreinvite=no
context=mycontext
host=sip.voiceall.net
secret=VOICEALL_PASSWORD ;your password
type=peer
username=VOICEALL_USERNAME ;your account
disallow=all
allow=ulaw

fromuser=VOICEALL_USERNAME ;your account
trustrpid=yes
sendrpid=yes
insecure=invite
nat=yes

The extensions.conf file is as below:

[mycontext]

include => voiceall-outbound

[voiceall-outbound]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@voiceall)
exten => _1NXXNXXXXXX,n,Playback(/home/Documents/demonew1)
exten => _1NXXNXXXXXX,n,Hangup()
exten => _NXXNXXXXXX,1,Dial(SIP/1${EXTEN}@voiceall)
exten => _NXXNXXXXXX,n,Playback(/home/Documents/demonew1)
exten => _NXXNXXXXXX,n,Hangup()
exten => _011.,1,Dial(SIP/${EXTEN}@voiceall)
exten => _011.,n,Playback(/home/Documents/demonew1)
exten => _011.,n,Hangup()

Please help me out, as i am new to asterisk.
Any help will be appreciated. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:24:01+00:00Added an answer on June 1, 2026 at 1:24 pm

    A few things to note before I comment on your originate command:

    1. A python wrapper library for AMI over TCP already exists: starpy. You may want to check that out, as it will reduce the amount of re-inventing the wheel you’ll need to do in order to get yourself up and running.

    2. In general, you probably shouldn’t use separate TCP sends for each parameter in an AMI action. Instead, you should send each message separately. In general, starpy handles this quite well by treating each AMI action as a dictionary of key/value pairs, which obviously maps quite well to AMI’s syntax. If you decide not to use starpy, you may still want to see how they map generic dictionaries to AMI actions.

    3. Do you have the appropriate classes of authentication for your user in manager.conf? In order to originate a call, your user will need the originate class on the write authorization

    In your origination, you’re attempting to dial SIP/voiceall/919833000000. That implies that Asterisk will create a SIP channel and start its pbx_thread at context voiceall-outbound (because its the default context for the peer you specified), at the extension matching what you specified.

    First, your extension that you’re attempting to place is 919833000000. You don’t have an extension that matches this – the closest you have is _NXXNXXXXXX. This specifies that its a pattern match, that the first character must be a number [2-9], the next two characters are numbers [0-9], the fourth character is a number [2-9], and the next six characters are numbers [0-9], for a total of 10 characters. The extension you’re specifying is 12 characters. I would expect the originate to fail.

    Let’s assume that the originate did succeed, and you had a pattern match extension with the same applications as _NXXNXXXXXX. A channel that you’re originating is going to be tied to something else – either another context,extension,priority in the dialplan, or an application. In your case, you’ve specified both: an application to connect to (Playback), with data you’re passing to it, as well as a context and a priority (but no extension). That’s not valid. From Asterisk’s ‘manager show command originate’:

    Exten
    Extension to use (requires ‘Context’ and ‘Priority’)
    Context
    Context to use (requires ‘Exten’ and ‘Priority’)
    Priority
    Priority to use (requires ‘Exten’ and ‘Context’)

    In general, you don’t combine Application/Data with Context,Exten,Priority. The Application/Data option exists when you want to only do very simple actions with what you dial – in your example, playing back a message fits the bill, but in general, I prefer to connect it to something else in the dialplan so I have more control. I’ll assume you want to use Context,Exten,Priority – in which case, you could do something like the following:

    [testing]
    exten => internal_playback,1,NoOp()
    same => n,Playback(/home/Documents/demonew1)
    same => n,Hangup()
    
    [voiceall-outbound]
    exten => _9XXXXX000000,1,NoOp()
    same => n,Dial(SIP/${EXTEN}@voiceall)
    same => n,Hangup()
    

    Your originate would then look something like this:

    Action: Originate
    Channel: local/internal_playback@testing
    Context: voiceall-outbound
    Exten: 919833000000
    Priority: 1
    

    You’ll note that we’re no longer using a SIP channel to call into the dialplan. You could still use a SIP channel in your originate – its really just a personal preference here.
    The Dial application will already create a SIP channel for us and bridge it to whatever we originate, so we just use a local channel. For our local channel, we connect one end to our internal playback extension that we use to play sound out to the dialed party, and the other end to our outbound extension.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.