Summary:ASTERISK-12278: [patch] PacketCable NCS 1.0 Support for Docsis / Eurodocsis Networks
Reporter:Eduardo Ferro (eferro)Labels:
Date Opened:2008-06-30 03:24:20Date Closed:2009-11-02 16:34:42.000-0600
Versions:Frequency of
is related toASTERISK-24500 Regression introduced in chan_mgcp by SVN revision r227276
Environment:Attachments:( 0) chan_mgcp.c.patch
( 1) digitmaps.patch
( 2) digitmaps-example_conf.txt
( 3) ncs-pktccops-1.6-r148241.tar.bz2
( 4) ncs-pktccops-12950.patch
( 5) ncs-pktccops-12950-r206632.patch
( 6) ncs-pktccops-12950-r206803.patch
Description:This patch add the minimal required support to make work (without great problems) some NCS 1.0, eMTAs...

At this time we have working in final customers around 4000/5000 lines using this software and the following eMTAs:

   * Arris 401 B (Eurodocsis)
   * Arris 401 A (Docsis)
   * Arris 402 B (Eurodocsis)
   * Arris 402 A (Docsis)
   * Arris 501 B (Eurodocsis)
   * Arris 501 A (Docsis)
   * Arris 502 B (Eurodocsis)
   * Arris 502 A (Docsis)
   * Arris Wi-Fi WTM552 B (Eurodocsis)
   * Arris Wi-Fi WTM552 A (Docsis)
   * Scientific Atlanta EPX2203
   * Terayon TA202 (EuroDOCSIS)

We know that it work with other models as well, but these are the models we have working at production sites...

This code is a evolution of a initial NCS patch download from http://asterisk.urtho.net/tiki-index.php (Sorry but I don't have the author name and the URL is not working)....


The following developers (from Alea Soluciones) works in this code:
* irojo@alea-soluciones.com (main developer)
* sven@alea-soluciones.com (Mgcp / NCS expert)
* eferro@alea-soluciones.com

We have pending to migrate the code to 1.6, but we have no chance (for the moment to test in production eviroments.... we can only test in our labs)...
Comments:By: Eduardo Ferro (eferro) 2008-06-30 03:27:15

This patch is generated with svn diff using http://svn.digium.com/svn/asterisk/tags/1.4.17 tag version

By: adomjan (adomjan) 2008-07-02 09:03:14

I'm working initial realtime support and I have initial packetcable dqos cops support.

*CLI> pktccops show gates
CMTS             Gate-Id      MTA          Status     AllocTime  CheckTime
--------------   ----------   ----------   --------   --------   --------

teszt            0x355b0001   0x0a000102   Open               29         29 0

MOT#show packet-cable gate
DQoS Gate Information
GateID |    Modem     |  Subscriber   |CMTS|   SFID    |   Status   | Committed
 (0x)  | MAC Address  |  IP Address   |Slot| Up  | Dn  |            |   Time
355B0001 0015.2f82.63a2    0  4054  4055    Committed   00:00:01

By: Tilghman Lesher (tilghman) 2008-07-02 13:27:12

If this is a derived patch, then we need license approval from that developer.  If you cannot track down the author, then this patch is dead in the water.

By: Pawel Pierscionek (urtho) 2008-07-14 05:24:06

I am the original developer of the patch that used to be located at my domain asterisk.urtho.net.

I've just signed the online contributors agreement so Digium is free to do to whatever they want with the original code which is apparently the base for the attached NCS-1.4.17.patch :)

By: Tilghman Lesher (tilghman) 2008-07-14 11:42:06

Okay, this needs to be converted to trunk.  Also, the new application embedded in here is more suitable to be a dialplan function, and, in particular, should be created as an argument to the CHANNEL() dialplan function, as it implements something that is channel-specific.

By: Eduardo Ferro (eferro) 2008-08-06 12:06:08

ncs-trunk.patch is the patch for svn trunk (r136067). It include only the core code for ncs (it have no "mgcp show line application").

By: Eduardo Ferro (eferro) 2008-08-06 12:09:21

Any tips or samples to implement:

"Also, the new application embedded in here is more suitable to be a dialplan function, and, in particular, should be created as an argument to the CHANNEL() dialplan function, as it implements something that is channel-specific."

Any samples?

By: snuffy (snuffy) 2008-08-06 16:30:14

It requires a callback be registered.
chan_iax2.c is one example of extra channel() parameters (its iax2_tech struct)

By: snuffy (snuffy) 2008-08-19 01:47:13

Any progress on suggested changes?

By: Eduardo Ferro (eferro) 2008-08-19 02:49:16

I have an initial version but not tested (I've been on vacation)....

I hope to have a working version of the patch for the first of September.

By: Josip Djuricic (jdjurici) 2008-08-22 08:06:08

Hi there,

I've also worked on urtho patch, running stable version on 1.4.19.

If you agree I could help on this project, I'm not much of a programmer (it's been a long time), but I'm having very extensive knowledge on mgcp and mgcp ncs.

Also what I'm trying to create correctly is digit collection on modem, so that asterisk get's entire number instead of collecting one by one. (using Digit maps) ... I believe that could solve one of my biggest problems atm --> if you use speed dial (or memory dial) is that in that case phone opens line, and start's dialing, but in many cases I've seen is that it starts to dial before asterisk actually gets offhook indication, and signalize to modem to start sending him digits. In that case it either don't catch any digits at all or some of them are missing.

Did you noticed this kind of problems also or its just me?

BTW I would add digit map to a configuration file, so that you can change it quickly on the fly.

By: Eduardo Ferro (eferro) 2008-08-25 01:42:45

Hi jdjurici

Of course, any collaboration is welcome ... Pleased to work with you (as well as with anyone interested in PacketCable/NCS support for Asterisk).

Please send me an email to eferro@alea-soluciones.com so that we can join the code and coordinate the development.

P.D Is anyone else interested? adomjan?

Thanks in advance

By: adomjan (adomjan) 2008-08-25 02:34:47

I attached the current development, initial realtime (very simple) support, PacketCable COPS DQOS allocation support. It can be add to chan_sip (packetcable-2.0).
I plan to use it in production in this year, so I testing now under asterisk-1.6.0 svn.

By: Leif Madsen (lmadsen) 2008-09-15 13:11:42

I have changed this status to Confirmed as there appears to be a patch ready to somewhat test, but I would like to have a developer perform a code audit first in order to determine if this is Ready for Testing.

By: Eduardo Ferro (eferro) 2008-09-16 16:32:33

The ncs-1.6-r143269.patch file contains the patch updated to svn revision 143269 and includes code to access ncs flag from channel() dialplan function.

It not include the patch send be adomjan (25-8-2008) because I don't know how can I test it, sorry...

By: adomjan (adomjan) 2008-09-16 17:42:15

There is a res_pktccops.conf sample

In cmts section the pool define the pools of the MTAs ( to decide which cmts using for GateAlloc )

so your cmts ip

host =
pool = -

By: Leif Madsen (lmadsen) 2008-10-06 10:13:07

Guess there is a sample file for you to use to test with. Can you update us with any progress on your testing?

By: Eduardo Ferro (eferro) 2008-10-09 12:20:48

I have almost complete a patch that integrate both patches (ncs-1.6-r143269.patch  &  mgcp_ncs_pktccops-20080825.tar.bz2) and the code upgraded to digium svn today version. I hope to have a working version of the patch tomorrow or the next monday.

Also I should contact with adomjan for some code conflicts between the patches. So, adomjan, please, send me a message to eferro@alea-soluciones.com to talk about the code integration

By: adomjan (adomjan) 2008-10-09 14:08:32

good to hear :)
btw the cops protocol works fine with cisco bsr also...
this small patch fix a potential segfault in res_pktccops.c.

By: Eduardo Ferro (eferro) 2008-10-10 03:43:39

The ncs-pktccops-1.6-r148241.tar.bz2 package contains a join of the following code:
* mgcp_ncs_pktccops-20080825.tar.bz2
* ncs-1.6-r143269.patch
* res_pktccops.c-200809.patch
All this code is integrated an upgraded to svn Asterisk trunk r148241

Adomjam contact me, so we integrate all the pending code.
This package include all the previous relased code and is tested in our lab.

By: Leif Madsen (lmadsen) 2008-10-10 08:36:50

Does this mean this bug merges in code from several other bugs? If so, which ones so that we can keep all this in one place if necessary.


By: Eduardo Ferro (eferro) 2008-10-10 09:39:57

No, all the code is oriented to provide PacketCable NCS 1.0 Support
for Docsis / Eurodocsis Networks to asterisk, so have sense to have
the same bug/issue id.

Our patch is centered in NCS base support (not realtime)
(NCS-1.4.17.patch, ncs-trunk.patch, ncs-1.6-r143269.patch) and adomjan
work to improve the NCS support including basic real time and
packetcable dqos cops (mgcp_ncs_pktccops-20080825.tar.bz2,

So yesterday I talk with adojam for integrate the code, and the
resulting code is ncs-pktccops-1.6-r148241.tar.bz2 that provide NCS
support for Asterisk with the following characteristics:

- static config
- basic real time config
- packetcable dqos cops

Hope this note help

By: Leif Madsen (lmadsen) 2008-10-10 12:33:53

OK, that helps. Is there really only one patch that should be attached to this issue, with the other remaining issues being removed?

ncs-pktccops-1.6-r148241.tar.bz2  <-- file to keep?

By: Eduardo Ferro (eferro) 2008-10-10 17:29:17

yes, this is the correct file.

By: pennyeasy (pennyeasy) 2008-11-23 21:17:04.000-0600

Can somebody tell me how to use this patch? Thanks.

By: adomjan (adomjan) 2008-11-24 03:11:59.000-0600

chan_mgcp.c.patch [^] (553 bytes) 2008-11-24 03:06:

dont't sent ring notofication to the MTA if we already sent sdp, because mta will play the ring tone instead of media inban indication. I run in this problem with ss7. I got inband indication flag in ACM, and later ring in CPG while mobile provider are sending "The subscriber unavailable" voice message.

By: John Todd (jtodd) 2009-03-09 19:34:09

This patch is getting whiskers, and I saw some ancillary comments in the last few weeks about people being interested in NCS compatibility for Asterisk, which this apparently provides.

If you're watching this bug, or using the patches, your testing data as additions on this ticket would be invaluable in helping getting this towards final inclusion in Asterisk.

By: Eduardo Ferro (eferro) 2009-03-10 15:04:44

For using this path with configuration using conf files, yo only need
to patch the code and modify the "mgcp.conf" file indicating the devices
(MTA) that use NCS protocol (with the conf parameter ncs=1)

For example, as global conf we use:

port = 2727
bindaddr =
disallow = all
allow = alaw
allow = ulaw

And to define a MTA device using NCS with two lines (aaln/1, aaln/2)
we use something similar to:

wcardep = aaln/*
singlepath = no
ncs = 1
nat = never
singlepath = no
host = mta23.pov.ddns
dtmfmode = rfc2833
context = Externas
language = en
callerid = "" <1252>
transfer = no
threewaycalling = no
mailbox =
line = aaln/1
dtmfmode = rfc2833
context = Externas
language = en
callerid = "" <1253>
transfer = no
threewaycalling = no
mailbox =
line = aaln/2

To define a MTA device with only a line (aaln/1), we use something
similar to:

wcardep = aaln/*
singlepath = no
ncs = 1
nat = never
singlepath = no
host = mta131.pov.ddns
dtmfmode = hybrid
context = Internas
language = en
callerid = "" <1322>
transfer = no
threewaycalling = no
mailbox =
line = aaln/1

In fact, the only conf value added is ncs = 1, on each NCS device. The
others conf parameters are the normal for mgcp.conf.

Hope this help

By: Olle Johansson (oej) 2009-06-23 10:12:26

Assigning this to me as I have promised the developers to help with the process - but that doesn't mean that lmadsen can't help too :-)

Created branch team/oej/mgctpstuff-12950 for this patch.

By: Eduardo Ferro (eferro) 2009-07-05 15:25:04

The ncs-pktccops-12950.patch file is a update of the previous files ncs-pktccops-1.6-r148241.tar.bz2 and chan_mgcp.c.patch generated against team/oej/mgctpstuff-12950 branch created by oej....

By: adomjan (adomjan) 2009-07-05 16:21:08

by the time I made tons of fixes in chan_mgcp, we are close to production now, and semes I eliminated tons of deadlocks which are still present the original chan_mgcp.c. Calling many point mgcp_queue_hangup without locked sub->lock, etc
and many more fixes, I fill produce patches when I will have time

By: Eduardo Ferro (eferro) 2009-07-15 04:09:19

ncs-pktccops-12950-r206632.patch is the same patch upgraded to r206632 (generated generated against team/oej/mgctpstuff-12950)

By: Eduardo Ferro (eferro) 2009-07-16 04:58:09

ncs-pktccops-12950-r206803.patch is the same patch upgraded to r206803 (generated generated against team/oej/mgctpstuff-12950). This patch includes all the previous code, so it substitude the files ncs-pktccops-1.6-r148241.tar.bz2, chan_mgcp.c.patch, ncs-pktccops-12950.patch and ncs-pktccops-12950-r206632.patch

By: Nahuel Greco (nahuelgreco) 2009-07-24 19:28:19

I created a patch against ncs-pktccops-12950-r206803.patch to send digitmaps definitions to endpoints, so endpoints will collect digits and send a single NTFY containing all of them ("enbloc" mode), instead of a NTFY per digit ("overlap" mode). Using this patch existing configuration files will exhibit the same behaviour as before applying it, so this is a backwards compatible change. See the attached digitmaps.patch and the example usage in digitmaps-example_conf.txt. Notes:

- A CLI command "mgcp show digitmaps" was added.

- Realtime doesn't have an analogous to "=>" definitions, so if you want to reference a digitmap from an endpoint defined with Realtime use the '@' syntax.

- Using Realtime with digitmaps was not tested at all, but I think it must work ok.

- Some Motorola MTAs seems to malfunction if the digitmap sent is not enclosed between parentheses, so always use them.

By: adomjan (adomjan) 2009-07-24 19:41:14

Here is my working version:
svn co https://observer.router.hu/repos_pub/chan_mgcp/new_lock

I have ~20k calls/day.

- fixed many deadlocks and dangerous situations (the original chan_mgcp also has!!!)
- disabled transfer/conference function (not needed and dangerous)
- fixed callwaiting tone
- added option for callwaiting, enable callwaiting only, if the channel is up not in dialing, ring or ringing state
- added option sending 'fake' OK on RSIP for unconfigurad MTAs
- many other fixes

By: adomjan (adomjan) 2009-07-27 15:12:29

Oops I forgot
svn co https://observer.router.hu/repos_pub/res_pktccops/trunk/

another remark for chan_mgcp: aded diaplan variable MGCP_IGNORE_DTMF_DETECT to avoid generating DTMF from notify for outgoing calls. It's ugly but at lwast works fine the alarm calls, they send ~10 DTMF(like) digits/sec. A set this variable when the call going out from our network via ss7.

By: Olle Johansson (oej) 2009-08-27 07:13:31

OK, sorry that I've been ignoring this for a while. Will try to merge to my branch soon.

Question: is the patch in issue 15159 anything related to this?

(I have no clue about MGCP, so it may be a very, very, very stupid question...)


By: Eduardo Ferro (eferro) 2009-08-30 18:46:51

This patch have no relation with the 15159 issue. The patch, implements the Packet Cable NCS protocol, that is 99% equal to MGCP protocol, but it is not the same protocol.


By: Tilghman Lesher (tilghman) 2009-11-02 11:54:38.000-0600

Could we get a new patch uploaded?  The latest patch does not seem to cleanly apply to trunk.

oej: your branch appears to be identical to trunk, other than some property changes.

By: Digium Subversion (svnbot) 2009-11-02 16:34:38.000-0600

Repository: asterisk
Revision: 227049

U   trunk/CHANGES
U   trunk/channels/chan_mgcp.c
U   trunk/configs/mgcp.conf.sample
A   trunk/configs/res_pktccops.conf.sample
A   trunk/include/asterisk/pktccops.h
A   trunk/res/res_pktccops.c

r227049 | tilghman | 2009-11-02 16:34:38 -0600 (Mon, 02 Nov 2009) | 7 lines

Add PacketCable NCS 1.0 support for Docsis/Eurodocsis networks
(closes issue ASTERISK-12278)
Reported by: alea-soluciones
      ncs-pktccops-12950-r206803.patch uploaded by alea-soluciones (license 514)
Tested by: alea-soluciones, adomjan, urtho, nahuelgreco