Copy Voicemail to another extension

Talk with others about developing applications for Switchvox

Moderators: bmdhacks, dpodolsky, tristand, jwitt, joshuas

Copy Voicemail to another extension

Postby wasca » Wed Feb 22, 2012 5:54 am

Hello

I'm new to switchvox and the api and I have a unique situation.

Is there a way to copy voicemail messages between extensions?
wasca
Newsterisk
 
Posts: 9
Joined: Wed Feb 22, 2012 5:41 am

Re: Copy Voicemail to another extension

Postby dpodolsky » Thu Mar 01, 2012 11:04 am

I guess more details on what you are trying todo would help.

If you just want to forward (copy?) messages from one mailbox to another then look into using the api voicemail.forward. LInk below:
http://developers.digium.com/switchvox/wiki/index.php/Switchvox.users.voicemail.forward
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: Copy Voicemail to another extension

Postby wasca » Thu Mar 01, 2012 8:06 pm

Thanks for the reply.

To extend on what I'm trying to do I need to trigger this copy from a link I place in the voicemail template email that is sent to the user. This is the link I'm trying to craft.

https://myserver.com/copyvm.php?vmid=%VM_MSGNUM%

this produces a link like this

https://myserver.com/copyvm.php?vmid=vm ... NE8Lu5jJ4Q

I then try to use "vmid" in my php file to do the copy of the voice mail from one extension to another, however this method Switchvox.users.voicemail.forward uses a message is like this <message_id>1</message_id> not <message_id>vm-F7D41S42a6mVNE8Lu5jJ4Q</message_id>

I need to be able to translate the %VM_MSGNUM% to a real message id for use in the forward method.

Is there a way to build a link like this...

https://myserver.com/copyvm.php?vmid=%VM_ID%

which would look like

https://myserver.com/copyvm.php?vmid=1

That way vmid will equal 1 and I can build my XML Request like this <message_id>1</message_id>

Thanks
wasca
Newsterisk
 
Posts: 9
Joined: Wed Feb 22, 2012 5:41 am

Re: Copy Voicemail to another extension

Postby dpodolsky » Fri Mar 02, 2012 10:51 am

I understand what you are trying to do, but I need more details on why you want to do this to give the best information. With the information I have, I can make a couple suggestions:

1. Feature Path
In Switchvox under the User -> Voicemail Options section, we have a "Forward" tab that allows you to configure a user's voicemail to be automatically forwarded to another user or a group of users. We even have built in round robin delivery if you want to spread out who gets the voicemail. If you want more people to get voicemails, just use this.

2. Forward from User
The voicemail is attached to the email. Can the user just fwd the email to the other recipient?

3. Developer Path (your original path / question)
When the email gets generated it hasn't been stored yet and thus there isn't a valid message id. However, at that time you do have other information you can match up like caller id number, name, duration, date, etc. I would send all this information to your PHP script. Then use users.voicemail.getList to go through the voicemail list of that user and find the one with the matching call information (caller id, name, date, duration) and save the message_id. Then you will have the correct message_id and you can call voicemail.forward. The only problem with this is if you have had multiple voicemails being left in the same mailbox from the same caller, for the same duration, within seconds of each other (very unlikely but I have to point it out).
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: Copy Voicemail to another extension

Postby wasca » Fri Mar 02, 2012 3:51 pm

Hi dpodolsky

Thanks for our reply. I'll try to explain in full why I'm trying to do all this.

Our support team policy works like this...

1. A client calls us and is asked to leave a message. This messages is saved to the support virtual extension 390.

2. The message is then emailed to a support team shared mailbox (in this case our custom internal crm system)

3. A Support staff member takes ownership of (claims) the voicemail email, no other staff will touch this email.

4. The Support staff member then proceeds to click the crafted url that I spoke about in earlier postings.

5. The voicemail is then sent to that support staff members pbx extension account.

6. Their snom300 phone is then automatically dialled to their voicemail and then the staff member listens to the message and then contacts the client if needed.

7. Once the staff member has listened to the message they delete it from their extensions voicemail account. If for some reason they need to listen to it again after they have deleted it, they simply go back to the email they claimed and click the link again and the process start's over again.

8. The original message that is saved in the virtual extension 390 is then (at the end of the working day) archived into our saved phone messages (I'm yet to write this code, so at the moment they will just stay in 390's inbox and be marked as read.)

Now onto answering your questions.

1. Feature Path
I'm aware of this option, however this will just blanket send to all our staff members, I would have no control over who is answering (claiming) the voicemail, so this wont work.

2. Forward from User
I was also aware of this but this too does not allow me to control who takes ownership of the voicemail.

3. Developer Path (your original path / question)
>>When the email gets generated it hasn't been stored yet and thus there isn't a valid message id
That's annoying that would have really helped, however when you do store message details in the database you could store the %VM_MSGNUM% in the same row with the message id, No? then in the api method Switchvox.users.voicemail.forward you could have the ability to reference a message perhaps like this <message_num>vm-F7D41S42a6mVNE8Lu5jJ4Q</message_num>. Now that would be super cool.

>>However, at that time you do have other information you can match up like caller id number, name, duration, date, etc.
Yes, I've discovered that already and that's what I've been doing so far, however it's not perfect. I've noticed the date time stamp put in the email template is nearly always about 2 seconds different to the date time stamp shown in the results from users.voicemail.getList.

Caller ID is not always dependable because some times there simply is no information for this i.e. Caller ID Blocked.

Duration is almost unusable. In the database you store the duration in seconds and miliseconds like this "24.67" however I noticed in the email template your code simply trims the miliseconds off and all I can send in the crafted url is "24"

>>The only problem with this is if you have had multiple voicemails being left in the same mailbox from the same caller, for the same duration, within seconds of each other (very unlikely but I have to point it out).

Yes I thought of this too, although it's possible, it would be highly unlikely to ever happen.

So what have I come up with so far? It's not perfect but it's working. I'm matching on a combination of Caller ID and date timestamp with a tolerance of +5 seconds. If the Caller ID is blocked, then I use date time stamp with a tolerance of +5 seconds and the "trimmed" duration.

So to finish up, it would be really handy if the %VM_MSGNUM% was stored in the database so we could reference it like this <message_num>vm-F7D41S42a6mVNE8Lu5jJ4Q</message_num> in the api

Wasca
wasca
Newsterisk
 
Posts: 9
Joined: Wed Feb 22, 2012 5:41 am

Re: Copy Voicemail to another extension

Postby dpodolsky » Fri Mar 02, 2012 5:20 pm

That's annoying that would have really helped, however when you do store message details in the database you could store the %VM_MSGNUM% in the same row with the message id, No? then in the api method Switchvox.users.voicemail.forward you could have the ability to reference a message perhaps like this <message_num>vm-F7D41S42a6mVNE8Lu5jJ4Q</message_num>. Now that would be super cool.


I agree, that would be cool. I have added this to the feature list to be able to use the voicemail APIs by the generated ID in the voicemail email.

So what have I come up with so far? It's not perfect but it's working. I'm matching on a combination of Caller ID and date timestamp with a tolerance of +5 seconds. If the Caller ID is blocked, then I use date time stamp with a tolerance of +5 seconds and the "trimmed" duration.


So it sounds like what you came up with is a great solution. It is how I would have built it out with the current API.
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: Copy Voicemail to another extension

Postby wasca » Sun Mar 18, 2012 10:26 pm

Just wondering when we could expect this feature in the API? When do you release updates to the API?

Wasca
wasca
Newsterisk
 
Posts: 9
Joined: Wed Feb 22, 2012 5:41 am

Re: Copy Voicemail to another extension

Postby dpodolsky » Thu Mar 22, 2012 5:17 pm

We don't provide any timelines on specific features. We release updates to the API when we update new version of our software.

With the 5.0 release of the software we introduced over 175 new Switchvox APIs. You can see the blog post found below to see the blog post and the full listing:
http://developers.digium.com/switchvox/blog/?p=735.

For the 5.5 release we introduced around 60 new Switchvox APIs. I hope to do another blog post with the list there. Expect to see even more new Switchvox APIs with every new version we release. Some of these APIs are for new features introduced in that release and others are exposing the API for existing features in the product.
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: Copy Voicemail to another extension

Postby wasca » Mon Apr 02, 2012 12:52 am

Just wondering if this has been fixed or an update to this issue with the release of version 5.5.2

Wasca
wasca
Newsterisk
 
Posts: 9
Joined: Wed Feb 22, 2012 5:41 am


Return to Switchvox Developers

Who is online

Users browsing this forum: No registered users and 2 guests