I am in the process of establishing a SIP-based system using SER which will allow my end
users to connect to each other and to dial out to the pstn using a SIP/pstn gateway run by
a provider downstream.
Some of the users on my system are consultants who work on several projects at once. They
would like to prefix the numbers they dial with their own arbitrary 4-digit project codes
for different calls and have the accounting I send them show the project code they used
for each call. Since my accounting is done downstream at the pstn gateway, and it shows
the username for each call, I would like to change the username on each of the calls going
out of my SER to include the project code. Then no changes would need to be made in the
billing software and each call will be easy to identify as to user and project.
Of course the project code would get stripped off so that just the correct uri is sent,
and I have figured out how to do that using the strip function. But I am new to SER and
just figuring my way through this, so I need a bit of help with the rest of it.
Here is an example of what I want to set up.
If user Mike wishes to call 1-111-1111 and wants to code it to project 1234, he would
dial:
*123411111111(a)wherever.com
and the outgoing uri would be just:
11111111(a)wherever.com (this is done using strip)
and the outgoing username would be:
mike1234
Note: the asterisk just indicates that a project code follows. Not all users will want
this feature and calls without an asterisk will be handled differently.
If I can do the last part (change the outgoing username to mike1234) I'll have it
cracked.
It would be best to do this within SER, but I don't see a way to do it. If there is a
way, please let me know.
So then it seems to me that the best thing might be to use the exec_dst command to pass a
set of commands to the shell would cause characters 2 through 5 of $SIP_ORURI to be
appended to the end of $SIP_USER. So something like:
EXPORT $SIP_USER=(characters 2-5 of $SIP_ORURI) ...... Obviously my bash-knowledge
needs a bit of work here ;-) If this would work, can someone tell me the shell commands
to use?
Alternatively, what about calling a small executable that reads the appropriate
environment variables and changes the value of $SIP_USER before returning to SER? I had
at first thought this might be the simplest way to do it, but now I understand that when a
program modifies an environment variable the variable returns to its original value when
the child process ends. If that is correct, then SER would never see the change.
Note that I'm aware that it would be easier to do this accounting on my own SER
system, where I have access to the original user name. However, since the pstn gateway at
the next hop does the official accounting and billing, I want the billing it produces to
include the project codes, and I think the easiest way to do this is for me to modify the
outgoing username.
I have been working away at this, starting from zero knowledge of Linux, but I've come
about as far as I can get. I would appreciate any advice.
Thanks,
Mike