Get value from the Presence module table

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Get value from the Presence module table

Pieri Mavarez
Hi, im trying to read the content from the table Presentity, more specifically, i want to read the file from 'body' field and use this information. 

How can i enter the database from the opensips.cfg file to use this info?

Thanks

Pierina M

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Get value from the Presence module table

Muhammad Shahzad
Use AVPOPS module, you can connect to any database and runny any SQL on it from within opensips.cfg,

http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750

However, using this method is mostly recommended for databases other then opensips own native database. If you can give some details about what you are trying to do then may be we can advise some OpenSIPs module or function to do the job without manually querying the native database.

Thank you.


On Fri, Aug 24, 2012 at 1:54 PM, Pieri Mavarez <[hidden email]> wrote:
Hi, im trying to read the content from the table Presentity, more specifically, i want to read the file from 'body' field and use this information. 

How can i enter the database from the opensips.cfg file to use this info?

Thanks

Pierina M

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +92 334 422 40 88
MSN: [hidden email]
Email: [hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Get value from the Presence module table

Pieri Mavarez
Hi,

What im trying to do is:

For exemple, if somebody is trying to call Bob and its status is 'busy', then send the call to another entity. For that, it is necessary to enter to the Presentity table and read the file that is in the 'body' field to find the status of the user.

Thanks, i hope i made myself clear :) i really dont know what to do. My boss adviced me to create a new module but i think that would be very hard to do.

Pierina M.


2012/8/24 Muhammad Shahzad <[hidden email]>
Use AVPOPS module, you can connect to any database and runny any SQL on it from within opensips.cfg,

http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750

However, using this method is mostly recommended for databases other then opensips own native database. If you can give some details about what you are trying to do then may be we can advise some OpenSIPs module or function to do the job without manually querying the native database.

Thank you.


On Fri, Aug 24, 2012 at 1:54 PM, Pieri Mavarez <[hidden email]> wrote:
Hi, im trying to read the content from the table Presentity, more specifically, i want to read the file from 'body' field and use this information. 

How can i enter the database from the opensips.cfg file to use this info?

Thanks

Pierina M

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: <a href="tel:%2B92%20334%20422%2040%2088" value="+923344224088" target="_blank">+92 334 422 40 88
MSN: [hidden email]
Email: [hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Get value from the Presence module table

osiris123d
In reply to this post by Pieri Mavarez
Pieri,

I am guessing there are more scenario's than "somebody is trying to call Bob and its status is 'busy', then send the call to another entity", but at least with the Bob scenario you could use the Dialog module and keep up with how many calls the CALLER has going and fail over to a different destination.

http://www.opensips.org/html/docs/modules/1.8.x/dialog.html#id294379
http://www.opensips.org/Resources/DocsTutorials#toc9

Does that help? Or are there more scenarios?



On , Pieri Mavarez <[hidden email]> wrote:

> Hi,
>
> What im trying to do is:
>
>
> For exemple, if somebody is trying to call Bob and its status is 'busy', then send the call to another entity. For that, it is necessary to enter to the Presentity table and read the file that is in the 'body' field to find the status of the user.
>
>
>
> Thanks, i hope i made myself clear :) i really dont know what to do. My boss adviced me to create a new module but i think that would be very hard to do.
>
>
> Pierina M.
>
>
>
> 2012/8/24 Muhammad Shahzad [hidden email]>
>
> Use AVPOPS module, you can connect to any database and runny any SQL on it from within opensips.cfg,
>
> http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750
>
>
>
>
> However, using this method is mostly recommended for databases other then opensips own native database. If you can give some details about what you are trying to do then may be we can advise some OpenSIPs module or function to do the job without manually querying the native database.
>
>
>
>
> Thank you.
>
>
> On Fri, Aug 24, 2012 at 1:54 PM, Pieri Mavarez [hidden email]> wrote:
>
>
>
>
> Hi, im trying to read the content from the table Presentity, more specifically, i want to read the file from 'body' field and use this information. 
>
>
>
> How can i enter the database from the opensips.cfg file to use this info?
>
>
>
> Thanks
>
>
> Pierina M
>
>
>
>
> _______________________________________________
>
> Users mailing list
>
> [hidden email]
>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
>
>
> --
> Muhammad Shahzad
> -----------------------------------
> CISCO Rich Media Communication Specialist (CRMCS)
>
> CISCO Certified Network Associate (CCNA)
>
> Cell: +92 334 422 40 88
> MSN: [hidden email]
> Email: [hidden email]
>
>
>
>
>
>
> _______________________________________________
>
> Users mailing list
>
> [hidden email]
>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
>
>
>
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Get value from the Presence module table

Pieri Mavarez
Sorry, you are right, but what if his status is 'absent'?

Thanks in advanced for your quick response!



2012/8/24 <[hidden email]>
Pieri,

I am guessing there are more scenario's than "somebody is trying to call Bob and its status is 'busy', then send the call to another entity", but at least with the Bob scenario you could use the Dialog module and keep up with how many calls the CALLER has going and fail over to a different destination.

http://www.opensips.org/html/docs/modules/1.8.x/dialog.html#id294379
http://www.opensips.org/Resources/DocsTutorials#toc9

Does that help? Or are there more scenarios?




On , Pieri Mavarez <[hidden email]> wrote:
> Hi,
>
> What im trying to do is:
>
>
> For exemple, if somebody is trying to call Bob and its status is 'busy', then send the call to another entity. For that, it is necessary to enter to the Presentity table and read the file that is in the 'body' field to find the status of the user.
>
>
>
> Thanks, i hope i made myself clear :) i really dont know what to do. My boss adviced me to create a new module but i think that would be very hard to do.
>
>
> Pierina M.
>
>
>
> 2012/8/24 Muhammad Shahzad [hidden email]>
>
> Use AVPOPS module, you can connect to any database and runny any SQL on it from within opensips.cfg,
>
> http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750
>
>
>
>
> However, using this method is mostly recommended for databases other then opensips own native database. If you can give some details about what you are trying to do then may be we can advise some OpenSIPs module or function to do the job without manually querying the native database.
>
>
>
>
> Thank you.
>
>
> On Fri, Aug 24, 2012 at 1:54 PM, Pieri Mavarez [hidden email]> wrote:
>
>
>
>
> Hi, im trying to read the content from the table Presentity, more specifically, i want to read the file from 'body' field and use this information. 
>
>
>
> How can i enter the database from the opensips.cfg file to use this info?

>
>
>
> Thanks
>
>
> Pierina M
>
>
>
>
> _______________________________________________
>
> Users mailing list
>
> [hidden email]
>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

>
>
>
>
>
> --
> Muhammad Shahzad
> -----------------------------------
> CISCO Rich Media Communication Specialist (CRMCS)
>
> CISCO Certified Network Associate (CCNA)
>
> Cell: <a href="tel:%2B92%20334%20422%2040%2088" value="+923344224088" target="_blank">+92 334 422 40 88
> MSN: [hidden email]
> Email: [hidden email]
>
>
>
>
>
>
> _______________________________________________
>
> Users mailing list
>
> [hidden email]
>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
>
>
>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Get value from the Presence module table

Muhammad Shahzad
In reply to this post by Pieri Mavarez
Well, If bob is busy since he has another call then you can use dialog module, create dialog profile with values for callers and when second call comes in you can check profile size of bob to determine if his is busy, and do whatever you want to do.

If bob is just busy but not in call then you can choose one of below solutions,

1. Use AVPOPS module to query bob's presence from db and check it using TEXTOPS module.
2. Load Perl module (if you are good in Perl) or EXEC module (if you want to use some other programming language) to run a custom script / program which would run for each incoming call. In that program you can implement even most complicated scenarios per your requirement. I personally recommend Perl since has much less overhead compared to EXEC module.

Thank you.


On Fri, Aug 24, 2012 at 4:39 PM, Pieri Mavarez <[hidden email]> wrote:
Hi,

What im trying to do is:

For exemple, if somebody is trying to call Bob and its status is 'busy', then send the call to another entity. For that, it is necessary to enter to the Presentity table and read the file that is in the 'body' field to find the status of the user.

Thanks, i hope i made myself clear :) i really dont know what to do. My boss adviced me to create a new module but i think that would be very hard to do.

Pierina M.


2012/8/24 Muhammad Shahzad <[hidden email]>
Use AVPOPS module, you can connect to any database and runny any SQL on it from within opensips.cfg,

http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750

However, using this method is mostly recommended for databases other then opensips own native database. If you can give some details about what you are trying to do then may be we can advise some OpenSIPs module or function to do the job without manually querying the native database.

Thank you.


On Fri, Aug 24, 2012 at 1:54 PM, Pieri Mavarez <[hidden email]> wrote:
Hi, im trying to read the content from the table Presentity, more specifically, i want to read the file from 'body' field and use this information. 

How can i enter the database from the opensips.cfg file to use this info?

Thanks

Pierina M

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: <a href="tel:%2B92%20334%20422%2040%2088" value="+923344224088" target="_blank">+92 334 422 40 88
MSN: [hidden email]
Email: [hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +92 334 422 40 88
MSN: [hidden email]
Email: [hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Get value from the Presence module table

Pieri Mavarez
Hi, thanks a lot for your help.
At the end i used AVPOPS for the query. I had to cut the BLOB variable because it was too long, and then i used the fonction pcre_match also from AVPOPS.


                       avp_db_query("SELECT body FROM presentity WHERE username='remy'","$avp(body)");
$var(body)=$avp(body);
$var(body)=$(var(body){s.substr,530,550});
                       if(pcre_match("$var(body)", "busy")){
.....
                        }

Pierina M.




2012/8/24 Muhammad Shahzad <[hidden email]>
Well, If bob is busy since he has another call then you can use dialog module, create dialog profile with values for callers and when second call comes in you can check profile size of bob to determine if his is busy, and do whatever you want to do.

If bob is just busy but not in call then you can choose one of below solutions,

1. Use AVPOPS module to query bob's presence from db and check it using TEXTOPS module.
2. Load Perl module (if you are good in Perl) or EXEC module (if you want to use some other programming language) to run a custom script / program which would run for each incoming call. In that program you can implement even most complicated scenarios per your requirement. I personally recommend Perl since has much less overhead compared to EXEC module.

Thank you.


On Fri, Aug 24, 2012 at 4:39 PM, Pieri Mavarez <[hidden email]> wrote:
Hi,

What im trying to do is:

For exemple, if somebody is trying to call Bob and its status is 'busy', then send the call to another entity. For that, it is necessary to enter to the Presentity table and read the file that is in the 'body' field to find the status of the user.

Thanks, i hope i made myself clear :) i really dont know what to do. My boss adviced me to create a new module but i think that would be very hard to do.

Pierina M.


2012/8/24 Muhammad Shahzad <[hidden email]>
Use AVPOPS module, you can connect to any database and runny any SQL on it from within opensips.cfg,

http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750

However, using this method is mostly recommended for databases other then opensips own native database. If you can give some details about what you are trying to do then may be we can advise some OpenSIPs module or function to do the job without manually querying the native database.

Thank you.


On Fri, Aug 24, 2012 at 1:54 PM, Pieri Mavarez <[hidden email]> wrote:
Hi, im trying to read the content from the table Presentity, more specifically, i want to read the file from 'body' field and use this information. 

How can i enter the database from the opensips.cfg file to use this info?

Thanks

Pierina M

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: <a href="tel:%2B92%20334%20422%2040%2088" value="+923344224088" target="_blank">+92 334 422 40 88
MSN: [hidden email]
Email: [hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: <a href="tel:%2B92%20334%20422%2040%2088" value="+923344224088" target="_blank">+92 334 422 40 88
MSN: [hidden email]
Email: [hidden email]

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users