[SR-Users] Writing a module

2013-08-20 Thread Grant Bagdasarian
Hello,

Is this page still up-to-date: 
http://www.kamailio.org/dokuwiki/doku.php/development:write-module ?

I'm researching what it takes to create our own custom Kamailio module.
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Alex Balashov

On 08/20/2013 06:41 AM, Grant Bagdasarian wrote:


Hello,

Is this page still up-to-date:
http://www.kamailio.org/dokuwiki/doku.php/development:write-module ?

I’m researching what it takes to create our own custom Kamailio module.


1. Skilled C programming.

2. What do you want to accomplish?  Are you sure no combination of 
existing modules and script constructs fit the bill?


Sometimes you really do need a custom module.  But I find those cases to 
be relatively few, at least for applications of Kamailio that are not 
truly exotic.


-- Alex

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Grant Bagdasarian
It's going to be a custom routing module, with our own business logic. 

It should load the routes from a database and keep refreshing the data every x 
interval. 
For SIP-to-PSTN calls (outgoing to carrier) we need to be able to route based 
on the callerprefix, customer id (which is added as a custom header), 
originating IP, and some other fields.
I need a way to select the closest matching route, or fallback to the default 
route, using the fields described above.

Implementing this logic in a stored procedure is quite hard. Another option 
would be to write a web service and perform http calls to determine the route. 
I'm just worried that http might delay the setup of calls.

Our routes table contains custom fields, but also fields which are used by the 
dispatcher module. So once a route is selected, the dispatcher module will use 
the uri in the route set to rewrite the ruri and possibly do failover. 

-Original Message-
From: sr-users-boun...@lists.sip-router.org 
[mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Alex Balashov
Sent: Tuesday, August 20, 2013 12:43 PM
To: sr-users@lists.sip-router.org
Subject: Re: [SR-Users] Writing a module

On 08/20/2013 06:41 AM, Grant Bagdasarian wrote:

> Hello,
>
> Is this page still up-to-date:
> http://www.kamailio.org/dokuwiki/doku.php/development:write-module ?
>
> I'm researching what it takes to create our own custom Kamailio module.

1. Skilled C programming.

2. What do you want to accomplish?  Are you sure no combination of existing 
modules and script constructs fit the bill?

Sometimes you really do need a custom module.  But I find those cases to be 
relatively few, at least for applications of Kamailio that are not truly exotic.

-- Alex

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list 
sr-users@lists.sip-router.org 
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Alex Balashov

On 08/20/2013 07:33 AM, Grant Bagdasarian wrote:


Implementing this logic in a stored procedure is quite hard.


Why?  It's exactly what our Kamailio-based LCR/routing/accounting 
product does.


-- Alex

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Olle E. Johansson

20 aug 2013 kl. 13:33 skrev Grant Bagdasarian :

> It's going to be a custom routing module, with our own business logic. 
> 
> It should load the routes from a database and keep refreshing the data every 
> x interval. 
> For SIP-to-PSTN calls (outgoing to carrier) we need to be able to route based 
> on the callerprefix, customer id (which is added as a custom header), 
> originating IP, and some other fields.
> I need a way to select the closest matching route, or fallback to the default 
> route, using the fields described above.
> 
> Implementing this logic in a stored procedure is quite hard. Another option 
> would be to write a web service and perform http calls to determine the 
> route. I'm just worried that http might delay the setup of calls.
> 
> Our routes table contains custom fields, but also fields which are used by 
> the dispatcher module. So once a route is selected, the dispatcher module 
> will use the uri in the route set to rewrite the ruri and possibly do 
> failover. 
On first look, I think you really should consider Alex proposal to see if you 
can get this done with the standard configuration
and existing modules. You might want a cron-script that refreshes htables, 
dispatcher tables or avp's loaded from database,
but I fail to see that it can't be done with existing logic.

/O
> 
> -Original Message-
> From: sr-users-boun...@lists.sip-router.org 
> [mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Alex Balashov
> Sent: Tuesday, August 20, 2013 12:43 PM
> To: sr-users@lists.sip-router.org
> Subject: Re: [SR-Users] Writing a module
> 
> On 08/20/2013 06:41 AM, Grant Bagdasarian wrote:
> 
>> Hello,
>> 
>> Is this page still up-to-date:
>> http://www.kamailio.org/dokuwiki/doku.php/development:write-module ?
>> 
>> I'm researching what it takes to create our own custom Kamailio module.
> 
> 1. Skilled C programming.
> 
> 2. What do you want to accomplish?  Are you sure no combination of existing 
> modules and script constructs fit the bill?
> 
> Sometimes you really do need a custom module.  But I find those cases to be 
> relatively few, at least for applications of Kamailio that are not truly 
> exotic.
> 
> -- Alex
> 
> --
> Alex Balashov - Principal
> Evariste Systems LLC
> 235 E Ponce de Leon Ave
> Suite 106
> Decatur, GA 30030
> United States
> Tel: +1-678-954-0670
> Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
> 
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list 
> sr-users@lists.sip-router.org 
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> 
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Daniel-Constantin Mierla

Hello,

devel guide is useful for writing own module:
- http://www.asipto.com/pub/kamailio-devel-guide/

Also, it was a recent discussion on sr-dev with hits about modules to 
look at:

- http://lists.sip-router.org/pipermail/sr-dev/2013-August/020977.html

Cheers,
Daniel

On 8/20/13 1:33 PM, Grant Bagdasarian wrote:

It's going to be a custom routing module, with our own business logic.

It should load the routes from a database and keep refreshing the data every x 
interval.
For SIP-to-PSTN calls (outgoing to carrier) we need to be able to route based 
on the callerprefix, customer id (which is added as a custom header), 
originating IP, and some other fields.
I need a way to select the closest matching route, or fallback to the default 
route, using the fields described above.

Implementing this logic in a stored procedure is quite hard. Another option 
would be to write a web service and perform http calls to determine the route. 
I'm just worried that http might delay the setup of calls.

Our routes table contains custom fields, but also fields which are used by the 
dispatcher module. So once a route is selected, the dispatcher module will use 
the uri in the route set to rewrite the ruri and possibly do failover.

-Original Message-
From: sr-users-boun...@lists.sip-router.org 
[mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Alex Balashov
Sent: Tuesday, August 20, 2013 12:43 PM
To: sr-users@lists.sip-router.org
Subject: Re: [SR-Users] Writing a module

On 08/20/2013 06:41 AM, Grant Bagdasarian wrote:


Hello,

Is this page still up-to-date:
http://www.kamailio.org/dokuwiki/doku.php/development:write-module ?

I'm researching what it takes to create our own custom Kamailio module.

1. Skilled C programming.

2. What do you want to accomplish?  Are you sure no combination of existing 
modules and script constructs fit the bill?

Sometimes you really do need a custom module.  But I find those cases to be 
relatively few, at least for applications of Kamailio that are not truly exotic.

-- Alex

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list 
sr-users@lists.sip-router.org 
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Grant Bagdasarian
Alright, thanks guys!

I'll have a closer look at the existing modules.

-Original Message-
From: sr-users-boun...@lists.sip-router.org 
[mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Daniel-Constantin 
Mierla
Sent: Tuesday, August 20, 2013 1:37 PM
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] Writing a module

Hello,

devel guide is useful for writing own module:
- http://www.asipto.com/pub/kamailio-devel-guide/

Also, it was a recent discussion on sr-dev with hits about modules to look at:
- http://lists.sip-router.org/pipermail/sr-dev/2013-August/020977.html

Cheers,
Daniel

On 8/20/13 1:33 PM, Grant Bagdasarian wrote:
> It's going to be a custom routing module, with our own business logic.
>
> It should load the routes from a database and keep refreshing the data every 
> x interval.
> For SIP-to-PSTN calls (outgoing to carrier) we need to be able to route based 
> on the callerprefix, customer id (which is added as a custom header), 
> originating IP, and some other fields.
> I need a way to select the closest matching route, or fallback to the default 
> route, using the fields described above.
>
> Implementing this logic in a stored procedure is quite hard. Another option 
> would be to write a web service and perform http calls to determine the 
> route. I'm just worried that http might delay the setup of calls.
>
> Our routes table contains custom fields, but also fields which are used by 
> the dispatcher module. So once a route is selected, the dispatcher module 
> will use the uri in the route set to rewrite the ruri and possibly do 
> failover.
>
> -Original Message-
> From: sr-users-boun...@lists.sip-router.org 
> [mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Alex 
> Balashov
> Sent: Tuesday, August 20, 2013 12:43 PM
> To: sr-users@lists.sip-router.org
> Subject: Re: [SR-Users] Writing a module
>
> On 08/20/2013 06:41 AM, Grant Bagdasarian wrote:
>
>> Hello,
>>
>> Is this page still up-to-date:
>> http://www.kamailio.org/dokuwiki/doku.php/development:write-module ?
>>
>> I'm researching what it takes to create our own custom Kamailio module.
> 1. Skilled C programming.
>
> 2. What do you want to accomplish?  Are you sure no combination of existing 
> modules and script constructs fit the bill?
>
> Sometimes you really do need a custom module.  But I find those cases to be 
> relatively few, at least for applications of Kamailio that are not truly 
> exotic.
>
> -- Alex
>
> --
> Alex Balashov - Principal
> Evariste Systems LLC
> 235 E Ponce de Leon Ave
> Suite 106
> Decatur, GA 30030
> United States
> Tel: +1-678-954-0670
> Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing 
> list sr-users@lists.sip-router.org 
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing 
> list sr-users@lists.sip-router.org 
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

--
Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda 
- http://www.linkedin.com/in/miconda


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Carlos Ruiz Díaz
There's also a Perl module that can be used to execute a Perl script
containing your business logic.

Sounds like you are doing lots of database queries and doing that from a C
module will always be more difficult than using a DB abstraction layer that
the one Perl provides.


On Tue, Aug 20, 2013 at 7:41 AM, Grant Bagdasarian  wrote:

> Alright, thanks guys!
>
> I'll have a closer look at the existing modules.
>
> -Original Message-
> From: sr-users-boun...@lists.sip-router.org [mailto:
> sr-users-boun...@lists.sip-router.org] On Behalf Of Daniel-Constantin
> Mierla
> Sent: Tuesday, August 20, 2013 1:37 PM
> To: Kamailio (SER) - Users Mailing List
> Subject: Re: [SR-Users] Writing a module
>
> Hello,
>
> devel guide is useful for writing own module:
> - http://www.asipto.com/pub/kamailio-devel-guide/
>
> Also, it was a recent discussion on sr-dev with hits about modules to look
> at:
> - http://lists.sip-router.org/pipermail/sr-dev/2013-August/020977.html
>
> Cheers,
> Daniel
>
> On 8/20/13 1:33 PM, Grant Bagdasarian wrote:
> > It's going to be a custom routing module, with our own business logic.
> >
> > It should load the routes from a database and keep refreshing the data
> every x interval.
> > For SIP-to-PSTN calls (outgoing to carrier) we need to be able to route
> based on the callerprefix, customer id (which is added as a custom header),
> originating IP, and some other fields.
> > I need a way to select the closest matching route, or fallback to the
> default route, using the fields described above.
> >
> > Implementing this logic in a stored procedure is quite hard. Another
> option would be to write a web service and perform http calls to determine
> the route. I'm just worried that http might delay the setup of calls.
> >
> > Our routes table contains custom fields, but also fields which are used
> by the dispatcher module. So once a route is selected, the dispatcher
> module will use the uri in the route set to rewrite the ruri and possibly
> do failover.
> >
> > -Original Message-
> > From: sr-users-boun...@lists.sip-router.org
> > [mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Alex
> > Balashov
> > Sent: Tuesday, August 20, 2013 12:43 PM
> > To: sr-users@lists.sip-router.org
> > Subject: Re: [SR-Users] Writing a module
> >
> > On 08/20/2013 06:41 AM, Grant Bagdasarian wrote:
> >
> >> Hello,
> >>
> >> Is this page still up-to-date:
> >> http://www.kamailio.org/dokuwiki/doku.php/development:write-module ?
> >>
> >> I'm researching what it takes to create our own custom Kamailio module.
> > 1. Skilled C programming.
> >
> > 2. What do you want to accomplish?  Are you sure no combination of
> existing modules and script constructs fit the bill?
> >
> > Sometimes you really do need a custom module.  But I find those cases to
> be relatively few, at least for applications of Kamailio that are not truly
> exotic.
> >
> > -- Alex
> >
> > --
> > Alex Balashov - Principal
> > Evariste Systems LLC
> > 235 E Ponce de Leon Ave
> > Suite 106
> > Decatur, GA 30030
> > United States
> > Tel: +1-678-954-0670
> > Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
> >
> > ___
> > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
> > list sr-users@lists.sip-router.org
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> >
> > ___
> > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
> > list sr-users@lists.sip-router.org
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla - http://www.asipto.com
> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>



-- 
Carlos
http://caruizdiaz.com
+595981146623
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Alex Balashov

On 08/20/2013 07:51 AM, Carlos Ruiz Díaz wrote:

There's also a Perl module that can be used to execute a Perl script
containing your business logic.

Sounds like you are doing lots of database queries and doing that from a
C module will always be more difficult than using a DB abstraction layer
that the one Perl provides.


... or just good old 'sqlops'.

The appearance of 'sqlops'[1] effectively obviated the need for writing 
most modules of this type.


The case for modules remains only in cases where you need novel 
capabilities in script.  Novel database interactions can be had via 
'sqlops' because it is generic and flexible.


-- Alex

[1] And really, avp_db_query() before it, but sqlops is just more flexible.

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Carlos Ruiz Díaz
Sure it's a great option but sometimes your business complexity demands not
only database queries but remote sockets connection, complex iteration over
result sets, doing some regex over the values, etc. Doing this kind of
stuff with Perl feels a lot more comfortable.




On Tue, Aug 20, 2013 at 7:53 AM, Alex Balashov wrote:

> On 08/20/2013 07:51 AM, Carlos Ruiz Díaz wrote:
>
>> There's also a Perl module that can be used to execute a Perl script
>> containing your business logic.
>>
>> Sounds like you are doing lots of database queries and doing that from a
>> C module will always be more difficult than using a DB abstraction layer
>> that the one Perl provides.
>>
>
> ... or just good old 'sqlops'.
>
> The appearance of 'sqlops'[1] effectively obviated the need for writing
> most modules of this type.
>
> The case for modules remains only in cases where you need novel
> capabilities in script.  Novel database interactions can be had via
> 'sqlops' because it is generic and flexible.
>
> -- Alex
>
> [1] And really, avp_db_query() before it, but sqlops is just more flexible.
>
>
> --
> Alex Balashov - Principal
> Evariste Systems LLC
> 235 E Ponce de Leon Ave
> Suite 106
> Decatur, GA 30030
> United States
> Tel: +1-678-954-0670
> Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
>
> __**_
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/**cgi-bin/mailman/listinfo/sr-**users
>



-- 
Carlos
http://caruizdiaz.com
+595981146623
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Writing a module

2013-08-20 Thread Alex Balashov

On 08/20/2013 08:01 AM, Carlos Ruiz Díaz wrote:


Sure it's a great option but sometimes your business complexity demands
not only database queries but remote sockets connection, complex
iteration over result sets, doing some regex over the values, etc. Doing
this kind of stuff with Perl feels a lot more comfortable.


That's very true.

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users