[Serusers] Fwd: Questions re. MySQL

frq ser frq.ser at googlemail.com
Fri Apr 11 15:57:06 CEST 2008


I think I've found the answer to Q2 in my below email. For example, if
wanted to retrieve the email address of user 1000, I'd use something like:
exec_msg ('P=$(mysql -u root -D ser --password=mypassword  -e "select
email_address from subscriber where username=1000"')

There is a problem though. If I type this on Linux shell:
> echo $P
the output is:
> email_address 1000 at localhost

does anyone know how to get rid of the field name and just get the value.
That is, instead of getting "email address 1000 at localhost", how could I get
just "1000 at localhost" ?
---------- Forwarded message ----------
From: frq ser <frq.ser at googlemail.com>
Date: Fri, Apr 11, 2008 at 1:41 PM
Subject: Questions re. MySQL
To: serusers at iptel.org


Hi,

Here's a set of basic questions for which I need your help.  I want to play
different announcements based on the caller's history. For simplicity, I
want ann1_user1.wav to be played for the first call, and ann2_user1.wav for
all subsequent calls from the 1st user. Similarly for 2nd user, the files
would be ann*_user2.wav.

1) I want to have a basic record of the number of  times a user has called
the SER(ie, sent an INVITE). Which table and column in mySQL can I use for
this purpose. Also, how can I write the integer using SER commands (ie
something that I can put in ser.cfg file). There is an example (
http://www.iptel.org/write_custom_text_to_mysql_acc_table) which uses
'acc_db_request', but it can only write to sip_status column in acc table.
How can I modify /write to to any general field in mysql?

2) Subsequently, how can I retreive this value from mysql through some
command in ser.cfg file. I want to use this value in an 'if' statement and
redirect the process flow accordingly.

3) I was thinking of rewriting the uri to make it 'ann1_user1 at xxxxx' and
sending the request to early_announce application so that the user hears
different announcement based on username and their call history (ie whether
this user has called before or not). However, I am not very clear about how
to do this. Is there any simpler method to do this. The final aim of this
whole exercise is to demonstrate call differentiation based on username and
user history. So if someone has a better idea then please do share it.

Thanks for the help and accept my apologies for squeezing so many questions
into a single message.

Regards,
Frq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20080411/455d2c29/attachment.htm>


More information about the sr-users mailing list