On 3/27/08, Jaime Blaney <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there any documentation or suggestions on how to implement a system for
> provisioning sip phones (grandstream in particular) in Astlinux?
> I know that using a tftp server the phone will download a cfg<MAC address>
> file with its configuration. But I want to know how to make it more
> dinamically. For instance, when I connect the phone it requests an ip
> address with DHCP, then the system automatically using the phone's mac
> address create the phone's cfg file containing an extension number, asterisk
> server location, etc.
> I'm a little lost on how to implement this in astlinux and how to write an
> script for this.
>
> Thanks,
>
> Jaime
>

Jaime,

  I thought of a way to do this a while back...

  First off, you could make mini_httpd (and Linux) treat .cfg files as
CGI and call something in PHP, etc to generate them on the fly.  Now
you only have one problem - mini_httpd will still return an HTTP 404
for any files that don't exist.  Hmm...  A while back I had a patch to
mini_httpd that would look at the User-Agent header and use a custom
polycom error document if the client was a Polycom.  The only trick
was getting the CGI code ini mini_httpd to actually *execute* for
error pages.  I got stopped there.

  You could make your Grandstreams use HTTP and modify this code a
little for their user agent string, file format, etc.

  This is the kind of thing that would be pretty straight forward in
Apache.  But that's not fun, is it? :)

  I've attached the small patch to these e-mail to hopefully get you started.

-- 
Kristian Kielhofner
--- mini_httpd-1.19.bhoc/mini_httpd.c	2007-10-31 02:49:08.000000000 -0400
+++ mini_httpd-1.19/mini_httpd.c	2007-10-31 02:50:26.000000000 -0400
@@ -1638,7 +1638,6 @@
     buflen = snprintf( buf, sizeof(buf), "\
 </PRE>\n\
 <HR>\n\
-<ADDRESS><A HREF=\"%s\">%s</A></ADDRESS>\n\
 </BODY>\n\
 </HTML>\n",
 	SERVER_URL, SERVER_SOFTWARE );
@@ -2395,8 +2394,6 @@
 
     send_error_body( s, title, text );
 
-    send_error_tail();
-
     send_response();
 
 #ifdef USE_SSL
@@ -2423,26 +2420,35 @@
 	    return;
 	}
 
+    /* If you're coming from a Polycom, try specific errors first. */
+    if ( match( "**Polycom-FileManager**", useragent ) )
+        {
+        (void) snprintf(
+            filename, sizeof(filename), "%s/pcom%d.html", ERR_DIR, s );
+        if ( send_error_file( filename ) )
+            return;
+        }
+
     /* Try server-wide custom error page. */
     (void) snprintf(
-	filename, sizeof(filename), "%s/err%d.html", ERR_DIR, s );
+        filename, sizeof(filename), "%s/err%d.html", ERR_DIR, s );
     if ( send_error_file( filename ) )
-	return;
+        return;
 
     /* Send built-in error page. */
     buflen = snprintf(
-	buf, sizeof(buf), "\
+        buf, sizeof(buf), "\
 <HTML>\n\
 <HEAD><TITLE>%d %s</TITLE></HEAD>\n\
 <BODY BGCOLOR=\"#cc9999\" TEXT=\"#000000\" LINK=\"#2020ff\" VLINK=\"#4040cc\">\n\
 <H4>%d %s</H4>\n",
-	s, title, s, title );
+        s, title, s, title );
     add_to_response( buf, buflen );
     buflen = snprintf( buf, sizeof(buf), "%s\n", text );
     add_to_response( buf, buflen );
+    send_error_tail();
     }
 
-
 static int
 send_error_file( char* filename )
     {
@@ -2486,8 +2492,6 @@
 	}
 
     buflen = snprintf( buf, sizeof(buf), "\
-<HR>\n\
-<ADDRESS><A HREF=\"%s\">%s</A></ADDRESS>\n\
 </BODY>\n\
 </HTML>\n",
 	SERVER_URL, SERVER_SOFTWARE );
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to [EMAIL 
PROTECTED]

Reply via email to