setting up the ealstix to be a voicemail server

Discussion in 'General' started by relianz, Jan 18, 2011.

  1. relianz

    Joined:
    Dec 7, 2009
    Messages:
    22
    Likes Received:
    0
    hi there , can any help me setup the elastix server to act as a voicemail server only. i need to connect it to a siemens pabx via the sie,ems analogue ports . i have a 6 port tdm800 fxo card connected to elastix server. this is what i have done so far ,
    i connected the siemens analogue extensions to the tdm800
    i forwarded the all the siemens extensions to call forward no answer to that group of extension connected to elastix.
    when i ring the siemens extension it forwards to the ipbx but rings only at swb.
    i tried to add a did ie siemens exte 9876 to go tto mailbox 9876. but it does not .
    please help i know its is some thing small ,

    plus i want the voicemail to be emailed to the users and it must be deleted after emailed .
     
  2. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Start here:-

    http://www.voip-info.org/wiki/view/Aste ... ntegration

    you need to program your PBX for "no-answer" to dial on the trunk that gets answered by Asterisk, "*<the_extension_that_you_want_to_handle_vm_for>", (You will need your PBX administrators manual to do this)

    You will need to create extensions in FreePBXD that match all your internal extensions (I suggest you use a custom trunk that dials back into the PBX for symmetry (ZAP/g1/<ext> for example), you will need to make the trunk that connects to the PBX in the context from-internal.

    You need to program your PBX to dial on the Asterisk trunk *98<ext> to retrieve VMails.

    You will further need to create a script that turns on and off your MWI internally on your PBX. and add:

    externnotify = /etc/asterisk/<your_script>

    to /etc/asterisk/voicemail.conf

    maybe the script looks something like (one I wrote a while back) :-

    Code:
    #!/usr/bin/perl -w
    # removes leading and trailing silence from voice mail messages and deletes them if less than half a second (phone hangup, slam down?)
    # dicko 5/19/2006
    # Duration in msgNNNN.txt file updated, messages not renumbered, do we care? (leave it to  voicemailmain)
    my ($context,$ext,$msgs,@junk) = @ARGV;
    my $callpath = "/var/spool/asterisk/tmp";
    my $callfile = "$callpath/lamp-".$ext."-" . time();
    
    die "Usage: vm_cleanup context ext messages \n" unless($ARGV[0]);
    
    $ext =~ s/\@default//;
    $dir = '/var/spool/asterisk/voicemail/default/'.$ext.'/INBOX';
    opendir(DIRHANDLE,$dir)||die "ERROR: can not read $dir\n";
    
    
    while(-e $dir."/.lock"){	#check for someone else being there
    	print STDERR "Lock file $dir/.lock exists, sleep a little . . \n";
    	sleep 2;
    	}
    system "touch $dir/.lock";
    
    @vmmsgs = reverse sort glob("$dir/*.txt");
    if ($vmmsgs[0]){
    		@fparts = split(/\//, $vmmsgs[0]);
    		@msgid = split(/\./, $fparts[8]);
    		system "sox  $dir/$msgid[0].wav  $dir/tmp.wav silence 1 1 2% reverse"; # trim leading silence
    		system "sox  $dir/tmp.wav  $dir/$msgid[0].wav silence 1 1 2% reverse"; # trim trailing silence
    		system "rm -f $dir/tmp.wav"; #
    		$filesize = -s "$dir/$msgid[0].wav";
    		$seconds = ($filesize/16000);
    		if ($seconds < 0.5)	#if too small, lets delete all trace of it
    			{
    			if($msgs){$msgs = $msgs - 1; }
    			system "rm -rf $dir/$msgid[0]*"; #
    			}
    		else
    			{
    			
    			system "sox  $dir/$msgid[0].wav -g $dir/$msgid[0].WAV &> /dev/null"; 
    			open NEWEST, "+<$vmmsgs[0]"||die "ERROR: can not read $vmmsgs[0]\n"; # and update length
    			flock NEWEST, 2;
    			@lines = <NEWEST>;			
    			seek NEWEST, 0, 0;
    			truncate NEWEST, 0;
    			$lines[14] ="duration=".int($seconds)."\n";
    			print NEWEST @lines;
    			close NEWEST;
    			
    			}
    		};
    closedir DIRHANDLE;
    system "rm -f $dir/.lock";
    
    
    
    
    
    open (VM, "</etc/asterisk/voicemail.conf");
    @vm=<VM>;
    
    @match=grep{/^$ext =>/}@vm;
    if (@match) {
    		foreach(@match)
    		{
    			@fields = split(/[,\|]/, $_);
    			@mwi = grep{/[Mm][Ww][Ii]=/}@fields;
    			if(@mwi){@lights = split(/\=/,$mwi[0]);}
    		}	
    	}
    
    
    if($lights[1]){
    	@extlamps = split(/[,\&]/,"$ext\&".$lights[1]);
    }
    else{
    	@extlamps = $ext;
    }
    
    foreach(@extlamps){
    
    if ($msgs > 0) {
    
    #change next line for code to turn MWI on
    
       $channel = "ZAP/g1/*20$_";
    	$cid = "$ext has $msgs vms - ON";
    		}
    else 		{
    	#dont turn off other phones - to be done
    		if ($_ == $ext){
    
    #change next line for code to turn MWI oFF
    
       			$channel = "ZAP/g1/#20$_"; 
       			$cid = "$ext has 0 vms - OFF";
    		}  
    		else {
    			if ( -e "/var/spool/asterisk/voicemail/default/$_/INBOX/msg0000.txt"){
     				#proceed with your code edit as appropriate
    				$channel = "ZAP/g1/*20$_";
    
    			}
    			else{ 
    				$channel = "ZAP/g1/#20$_";
    			}
    		}
    }
    
    
    print STDERR "channel: $channel\n";
    
    $callfile=$callpath."/lamp-".$_."-".time();
    
    open (CALLFILE,">$callfile");
    
    print CALLFILE qq(
    Channel: $channel
    MaxRetries: 20
    RetryTime: 1
    Context: custom-vm
    Callerid: "$cid" <$_> 	
    Extension: mwi
    Priority: 1
    );
    
    close(CALLFILE); 
    
    print STDERR "gone";
    system "cp $callfile /home/";
    system "mv $callfile /var/spool/asterisk/outgoing/";
    }
    
     
  3. relianz

    Joined:
    Dec 7, 2009
    Messages:
    22
    Likes Received:
    0
    thanks for the help . i can see it si coming togehter slowly , please i still dont understand how to make the pabx now answer , and to allow the cid to show . please can you be more specific , thank you
     
  4. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    No , I can't be more specific as to what I post,

    you say
    "i still dont understand how to make the pabx now answer "

    this is not understandable to me.
     
  5. relianz

    Joined:
    Dec 7, 2009
    Messages:
    22
    Likes Received:
    0
    you need to program your PBX for "no-answer" to dial on the trunk that gets answered by Asterisk, "*<the_extension_that_you_want_to_handle_vm_for>", (You will need your PBX administrators manual to do this)
     
  6. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    My apologies for being obtuse,

    I ask a question. How will the Voicemail system know which vm extension to answer? You will have to program that in your PBX.

    The PBX presumably came with lots of documentation, please read the fattest one, I assume it will tell you how to interface with an external VM system, I merely give you the basics from the Asterisk side as to what your PBX should send and expect.
     

Share This Page